How to create your first Java project in Eclipse

Home > Search > How-to

  1. In Eclipse, select  File > New > Java Project.
  2. Give your project a name, such as myJavaProject and select Finish.


  1. In the left panel of Eclipse, expand myJavaProject, right-click on the src folder and select New > Class.
  2. Give the new class a name, such as HelloWorld, and select Finish.
  3. Add the following markup.
package myJavaProject;
import javax.swing.JOptionPane;

public class myClass {
  public static void main(String[] args)
    System.out.println("Hello World");
    JOptionPane.showMessageDialog(null, "How are you today?");
  1. Select the green play button, and ensure Hello World is displayed in the console, and a pop-up box with text How are you today should also appear.

Add a Comment

We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.

Please enter in the box below so that we can be sure you are a human.