Subscribe

Eclipse Java - Hello World Application / Program


Share |

This article will create a Java project and a Java class in Eclipse that will print "Hello world!" in the console when run.

1) Open the Java Perspective
If you're not already in the Java perspective, in the main menu select Window > Open Perspective > Java or click on the "Click to Perform" link below.

2) Create a Java Project
Before creating a class, we need a project to put it in. In the main toolbar, click on the New Java Project button. Enter HelloWorld for the project name, then click Finish.

3) Create your HelloWorld Class
The next step is to create a new class. In the main toolbar again, click on the New Java Class button. Enter HelloWorld for the class name, select the checkbox to create the main() method, then click Finish.

4) Add a Print Statement
Now that you have your HelloWorld class, in the main() method, add the following statement:

System.out.println("Hello world!");
Then save your changes; the class will automatically compile upon saving.

5) Run your Java Application / Program

To run your application, right-click on your class in the Package Explorer and select Run As > Java Application. The Console view should appear at the bottom and display the "Hello, world!" output.

Congratulations! You have successfully created a Hello World application!

Share |

No comments yet

Hot Topics

My Headlines