×
☰ See All Chapters

Java program using eclipse

In the previous chapter we learnt to execute java simple program. There we have coded using notepad, actually we will not use notepad for coding in real time.  Eclipse is an open source, most popular development environments for Java, as it contains everything you need to develop a java project from scratch. Follow below steps to use eclipse to create java project.

1.  Download Eclipse IDE for java from Eclipse Website. You will get it in zip file format. Unzip it to get the executable files. This software is not required to install in OS, it is like portable software.

Launch eclipse by clicking on "eclipse.exe" which will be available inside the unzipped folder.

2.  When eclipse is opened, it asks for a workspace folder. Give your preferred location and press "ok". This workspace folder will be used by eclipse to save all our project work.

javaProgramUsingEclipse-0

After eclipse is launched

javaProgramUsingEclipse-1

3.  When eclipse is opened, it asks for a workspace folder. Give your preferred location and press "ok". This workspace folder will be used by eclipse to save all our project work.

javaProgramUsingEclipse-2

After eclipse is launched

javaProgramUsingEclipse-3

4.  Close welcome window, it is better to un select “Always show Welcome at start up” option at right bottom corner. Click on Open Perspective button and select Java option.

javaProgramUsingEclipse-4
javaProgramUsingEclipse-5

5.  Select File -> New -> Project -> Java Project -> Next

Enter the project name, Our project name is “HelloWorldDemo” , then click finish

javaProgramUsingEclipse-6

6.  Right click on the project select New -> Class

javaProgramUsingEclipse-7

Enter the Class Name. Our class name is "Demo".

Check the checkbox "public static void main(String args)"

Click on "Finish"

javaProgramUsingEclipse-8

7.  Write your program, we are adding a simple statement to write a message “Hello World” on console. After changes save the file (Press Ctrl+S)

 javaProgramUsingEclipse-9

public class Demo {

        public static void main(String[] args) {

                System.out.println("Hello World");

        }

}

8.  To run program, Right Click on your java file (Demo.java in our case),  select  -> "Run As" -> "Java Application"

Check the output on console


All Chapters
Author