Installing and Using Eclipse for Java
1. How to Install Eclipse IDE
Prerequisites:
- Java JDK must be installed before Eclipse.
Step 1: Install Java JDK
1. Go to: https://www.oracle.com/java/technologies/javase-downloads.html or https://adoptium.net
2. Download and install the latest Java SE Development Kit (JDK).
3. Verify installation:
- Open terminal or command prompt:
java -version
javac -version
Step 2: Download Eclipse IDE
1. Go to https://www.eclipse.org/downloads/
2. Click 'Download' under "Eclipse IDE for Java Developers".
3. Run the downloaded Eclipse Installer.
Step 3: Install Eclipse IDE for Java Developers
1. In the Eclipse Installer, choose "Eclipse IDE for Java Developers".
2. Select your install location (default is fine).
3. Click 'Install' and accept licenses.
4. Once installed, click 'Launch'.
Step 4: Choose a Workspace
- Select a folder as your workspace.
- Click 'Launch'.
Eclipse is now ready!
Installing and Using Eclipse for Java
2. How to Run a Simple Java Program in Eclipse
Prerequisites:
- Java JDK installed
- Eclipse IDE installed
Steps to Run a Simple Java Program:
1. Open Eclipse:
- Launch Eclipse and select a workspace.
2. Create a New Java Project:
- Go to File > New > Java Project
- Name the project (e.g., HelloWorldProject)
- Click Finish
3. Create a Java Class:
- Right-click on src > New > Class
- Name it (e.g., HelloWorld)
- Check the box: public static void main(String[] args)
- Click Finish
4. Write Your Code:
- Replace contents with:
public class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello, World!");
}
Installing and Using Eclipse for Java
5. Run the Program:
- Click the green Run button or right-click > Run As > Java Application
- Output should appear in the Console:
Hello, World!