Getting started with Java in Eclipse

1. Download Eclipse

Obtain the installer from the following site:

https://eclipse.org/downloads/

java1

and complete the installation:

java2

2. Create a new Eclipse project

Open Eclipse and select File > New > Java Project. Give the project a name (‘HelloWorld’):

java3

Click Next.

java4

And then click Finish.

3. Add your Java class

Select File > New > Class:

Set the Name field to ‘HelloWorld’ and check the box labelled ‘public static void main(String[] args)’:

java5

Click Finish.

So that your project looks like this:

java6

4. Write your code

In this example, the proverbial “Hello World” example:

public class HelloWorld {

	public static void main(String[] args) {
		System.out.println("Hello, World");

	}
}

5. Build and run your Java project:

Select the down arrow next to the Run icon and select Run As > Java Application:

java7

Giving the desired “Hello World” console output:

java8