Write Hello World program using Eclipse

This entry is part 10 of 34 in the series Core Java Course

In this tutorial we will learn to create the Hello World application using Eclipse IDE. To understand the following material you should be familiar with using Eclipse for instructions on Eclipse Click Here.

Creating the Project

To create our project select File >> New >> Java Project from the menu. If you can’t find “Java Project” as an option then click “Other” as shown below.

1

Select Java Project from the next window and click Next. Provide a project name as shown below.

2

 

3

Click Finish. Eclipse will ask you to change the perspective to Java Perspective. Click Yes. As you can see a new Java project will appear in the Package Explorer view in the Java Perspective.

4

Creating a Package

Now we will create a package in our Java project. Packages are used to avoid naming conflicts, to control access (Access Modifier) and to bundle groups of related types.

To create your package select the src folder in your Java project (JBTProject), Do this by right clicking on it and select New >> Package.

 

6

Enter the package name in the dialog box and click Finish.

Steps to Create the Java Class

Once your package is created we can create the Java class inside the package. Right click on the package in which the Java Class is to be created and select New >> Class.

7

8

Provide the Class name in the dialog box and click Finish. Other options are available to choose from. Select Other Option to create your main Methods.

Once Class is created the structure of the project would be as shown below.

9

Compile & Run Java application

After creating the Java application the next step would be to compile and run the code.

Compile the code

To compile the code use the keyboard short cut “CTRL+B”. It will build the Java applications. If you want to build a single application then click the application and select Project >> Build Project from menu.

Run the code

To run the code you can either use the keyboard shortcut “ALT+SHIFT+X” and J.

Or you can click the file and select Run >> Run As >> Java Application from the Menu.

Once you click Run the Hello World application will be executed and your output will be displayed in the console view.

We have now learned to create the Hello World application in Eclipse. In the next article we will discuss some other features provided by Eclipse which makes coding easier.

Series Navigation<< public static void main(string args[]) ExplanationAccess Modifiers in Java >>

9 Comments Write Hello World program using Eclipse

  1. Abdul Irshad

    Hi My name is Irshad,i have four years of BPO related experiance.Now i am trying to get job in IT filed,so through learning JAVA..shall i get job in outside..Please advice?

    Reply
    1. J Singh

      Hi Irshad,

      I cant say if you get job or not. It all depend on weather you can prove that you are good in Java. Second thing instead of looking for job outside you better search for a project in same company using java. And gain experience and then go outside of your current company.

      Regards

      Reply
  2. pooja pandey

    hi my name is pooja. i have four years gap from graduation. now i am trying to get a job in it field through learning java. can i get job in IT plz advice.

    Reply
    1. J Singh

      Hi Pooja, having a gap of 4 year wil definately create problem for you. But it is not impossible to get a job. You can try startup companies or small one. There you have beter chance to get job. After you gain knowledge in lang. And once you have experience, you can apply for bigger companies.

      Regards

      Reply

Leave A Comment

Your email address will not be published. Required fields are marked *