Table of Contents
Introduction
This article will guide you in a step-by-step manner on how to code your first program on the Eclipse IDE. This will be a simple program where you will be printing out the words “Hello World” to the output screen.
Downloading and Installing Eclipse
We assume that you have already downloaded and installed the Eclipse IDE on your machine. If you have not, refer to the relevant installation articles. Use either the Eclipse IDE for JAVA EE Developers or the Eclipse IDE Classic packages to install.
Changing Perspective
If you have downloaded the JAVA EE package, the perspective will be JAVA EE by default. If you have downloaded the Classic pack, JAVA will be your default perspective. To make sure it is JAVA, in any case, goes to Window > Perspective > Open Perspective > Other > JAVA.
Making a new JAVA Project
Go to File > New > Java Project. Name the project Hello World and click on Enter. You will instantly see the HelloWorld project under Package Explorer.
Code
As you have to add a new class to the project HelloWorld, click on New > Class from the context menu. Thereafter, type in the following code:
public class HelloWorld { public static void main ( String args [] ) { System.out.println ( “Hello World” ); } }
You have thus coded your very first program on the Eclipse IDE. Eclipse is extremely user-friendly as it compiles your code as you write it. Thereafter, an error will be pointed out then and there rather than at run-time.
Compile Your Code
The last step to the process is compiling your code. As you are being able to run the code, there is no compile-time error. Click on Run > Run. You will see “Hello World” as the output to the code.
0 Comments