Running a Java Program using Eclipse

Here are some basic steps on how to install Eclipse ( A Java IDE ) and run a Java program using it. IDE means Integrated Development Environment. You may run and create Java programs using plain text and command line, but using an IDE gives you more tools and system integration.

Installation of Eclipse IDE

1. Download the Eclipse IDE from the internet ( just search “Eclipse IDE download” ).

2. Choose the IDE for Java SE ( for plain or Java Client Applications ), or Java EE ( for Java Web Applications, that can be hosted on a Web server ). C and C++ is also available, but we will be using Java this time.

3. Download the Eclipse version suited to your OS version ( Windows 32-bit, Windows-64 bit, Linux and etc… )

4. Eclipse needs JRE ( Java Runtime Environment only ) or JDK ( Also a Java Runtime Environment, with tools and add-ons for Java Development ) . For complete Java software development, JDK is recommended. If you just need some software to run on Java as its requirement, JRE is sufficient enough.

5. Extract the Eclipse file after download. Eclipse runs directly after extraction of the zip files, since it does not need any installation. Just click on the “eclipse.exe” icon.

6. Download JRE or JDK suited to your OS version. After the download, install the JDK / JRE in the eclipse folder.

Running a simple Java program

1. Open a “Workspace” on the Eclipse application

2. Create a new “Java Project” inside the workspace. Just choose the simple Java project available in the selection.

3. Create a “Class” under the Java project. The “Class” always starts with a capital letter. The Class should also have the method “public static void main(String[] args)”

4. Write a “Hello World” print screen inside the “public static void main(String[] args)” method. Use “System.out.println(“Hello World”)” line.

5. Check for compile errors. Java code does not run if it has compile errors.

6. Right click on the “Class” and select “Run as Java Appliacation”

7. See the Console tab in Eclipse and the text “Hello World” should appear.

This will appear on your screen if eclipse has run successfully

 

The Eclipse IDE with a Java Class

 

 

 

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s