How do you write a simple "Hello World" program in JAVA using eclipse?

Views: 2622
Comments: 0
Like/Unlike: 1
Posted On: 22-Apr-2018 03:12 

Share:   fb twitter linkedin
reena
122 Points
12 Posts

To write a "Hello World" cosole program follow these steps:

  1. Start Eclipse.
  2. Create a new Java Project:
    1. File->New->Project.
    2. Select "Java" in the category list.
    3. Select "Java Project" in the project list. Click "Next".

    4. Enter a project name into the Project name field, for example, "Nice World Project".

    5. Click "Finish"--It will ask you if you want the Java perspective to open. (You do.)

  3. Create a new Java class:
    1. Click the "Create a Java Class" button in the toolbar. (This is the icon below "Run" and "Window" with a tooltip that says "New Java Class.") OR right click on src on package explorer->New->class->click

    2. Enter "HelloWorld" into the Name field.

    3. Click the checkbox indicating that you would like Eclipse to create a "public static void main(String[] args)" method.
    4. Click "Finish".

  4. A Java editor for HelloWorld.java will open. In the main method enter the following line.
  5. System.out.println("Hello Nice World");
  6. Save using ctrl-s. This automatically compiles HelloWorld.java.
  7. Click the "Run" button in the toolbar (looks like a little man running).
  8. You will be prompted to create a Launch configuration. Select "Java Application" and click "New".
  9. Click "Run" to run the Hello World program. The console will open and display "Hello Nice World".
0 Comments
 Log In to Chat