This article describes how to create a "Hello World" java program using Eclipse IDE. This program will print "Hello World" in the console.

Technologies used in this article :

  1. JDK 1.6
  2. Eclipse 3.7

If JDK or Java is not installed in your computer, then follow the below step by step guidelines

How to Install Java on Windows 10 - Step by Step Guide for Java Beginners

1. Create Java Project

Select from the menu File --> New --> Java Project.
Create java project

Enter "HelloWorld" as the project name. Keep rest of the settings as it is as shown in the following screenshot.
Enter project name
Click "Finish" button and Eclipse IDE will generate the java project automatically.

2. Create Java Package

Right click on 'src' folder and select from context menu New --> Package.
Create java package

Write 'com.srccodes.example' in the 'Name' field and click "Finish" button.
Write package name

3. Create Java Class

Right click on 'com.srccodes.example' package and select from context menu New --> Class.
Create java class

Write "HelloWorld" in the 'Name' field and select the check-box for 'public static void main(String[] args)'.
Write class name

Click "Finish" button. Eclipse will generate a java class and open the same in the java editor as shown below.
generated class in java editor

4. Write Java Code

Edit the generated 'HelloWord' java class as per the following code.

File: HelloWorld.java

package com.srccodes.example;
 
public class HelloWorld {
 
    /**
     * @param args
     */
    public static void main(String[] args) {
        System.out.println("Hello World");
    }
 
}

5. Run Your Code

Right click on 'HelloWorld.java' and select from context menu 'Run As' --> 'Java Application'.
Run your code

6. Console Output

Your code will print 'Hello World' in the eclipse console.
Console Output

Download SrcCode

All code samples shown in this post are available in the following link Java-hello-world-example.zip

References