Hello World In Eclipse - Java
Most of the students and fresh developers don’t know “How to write Hello World In Eclipse?”. It is so easy to learn how to write or create new project in eclipse.
What is an eclipse?
Eclipse is an integrated development environment that is used for developing computer programs in programming languages. The most of Java applications are developed using Eclipse IDE. It is open source and free to use.
How to create project in eclipse?
Step 1: Choose FILE MENU > PROJECT or (Alt + Shift + N) > PROJECT.
Create New Project In Eclipse
Step 2 : There is New Project wizard to choose different types of project wizards. We are doing Java core programming in this tutorial so select Java Project and Click Next button.
New Project Wizard In Eclipse
Step 3 : There is New Java Project wizard to create new java project.
- Project Name: The project need unique name for whole application.
- Location: Where to save your project in your local machine.
- JRE: JRE version selection according to your project requirement.
Create New Java Project
Finally you would have following screen with src directory and JRE in Project Explorer.
Scr in Project Explorer
How to create first program in Eclipse?
Step 1: Create class in eclipse. Right click on src directory > NEW > CLASS.
Create New Class
Step 2: New Java Class Wizard to create class.
- Source folder: It is a folder where you are going to create new class.
- Package: It is package define for class.
- Name: It is a Java Class Name.
- Modifiers: Access modifiers are for class access.
- Method Stub: By checked button, you may create main method stub.
New Class Wizard
You have created new class HelloWord in eclipse. The following screen should be there with main method stub.
New Created Class
Let's write a code to display hello world in command line.
Hello World in Eclipse
How to run Java Program in Eclipse?
Step 1: Right Click on Main Class File > Run As > Java Application.
Run Java Application
There is a output of the program in eclipse console.
The Output of program in Eclipse console