Hello World program using Eclipse in Java

Hello World program using Eclipse in Java

by | 26-Mar-2020



We are going to make our first Java program called Hello World. In this program, we’ll print a message to the console that says 'Hello World'. I’m using eclipse as my environment. It’s free software which you can use to write programs of various languages including Java. Here are the steps:

  1. First, you’re going to select Java Perspective. It’s an important step if you’re a beginner or you are new to eclipse IDE. Do that by going to Window (in top menu) > Perspective > Open Perspective > Other. Then select Java (default) in the dialog box as shown below and click Open. 


  1. Once you’re in Java perspective. Click on File (Top Menu) > New > Java Project


A dialog box will open as shown above. You will need to name your project in the Project name textbox at the top. I’ll name it HelloWorld. After entering the name of your choice click Finish. Leave the remaining things as it is. You’ll see a project created like shown below.


  1. Now, we’re going to create a new package. It’s not required but it’s discouraged to use the default package. Go to src folder and right click to open the menu. Click New > Package. A new dialog box will open as shown below.


Enter com.prgrmmng (or anything to your liking) into the name and click Finish.


  1. Right click on the newly created package. Select New > Class and a dialog will open like shown below.


Enter HelloWorld into the name and click Finish.
Note: You can select the checkbox saying public static void main(String[] args) to auto-generate the main method. I like to type it so I’m not checking it.

We’ll have the project as shown below.


  1. Now we are going to start typing the code to print Hello World. The code to print Hello World to the console is Systemout.println(“Hello World”);


  1. After writing the code we need to see the output. We need to run the program in order to do that. Click on Run (Top menu) > Run and you’ll see the console saying Hello World.


Congratulations you’ve just created your first Java program successfully. It might look complicated at first but once you get the hang of it, it’ll be very easy.


There are no comments.

Enter a new Comment:

Copyright Šprgrmmng. All rights reserved.