This workshop is for you, if you think

  • You are spending too much time in office writing getter setter methods
  • You are bored of seeing command prompts with hundreds of compilation errors even after writing a wonderful java code

This workshop is not for you, if

  • You are well versed with eclipse

What is this workshop all about?

We were successful in creating Hello World application with the help of textpad or notepad and got it compiled and run from command prompt.

But, hey isn't this a time consuming process, project dead lines doesn't give me such a leisure time.

We have IDE to the rescue!

This workshop will explain

  • Installation and set up of Eclipse
  • Execution of simple Hello World Application using Eclipse IDE

Prerequisite

  • JDK installed on system

For more information on how to install JDK you can refer to Java Hello World Article.

Installation and set up of Eclipse

Steps for eclipse installation are as below

  • To download eclipse clickEclipse 3.4
  • Start eclipse
  • Select the location for workspace
  • Eclipse installation doesn't come up with setup.exe file. To run eclipse simply execute eclipse.exe from extracted folder

 

 

Image showing the Eclipse Workspace Launcher

 

  • You will see the following eclipse welcome screen on successful start of eclipse application.

Image showing eclipse home page after successful installation

 

 


Execution of simple Hello World Application

  • Navigate to "File/New/Java Project" as shown below for creating the new Java Project naming "Hello World With IDE".

Image showing navigation for creating new Java Project in Eclipse IDE

  • Provide with following information in the given field.

Project Name: Hello World With IDE

  • Here you have the option to either Create new project in workspace or you can create project from existing source.
  • You can also use the previously created HelloWorld application as the existing source.
    But here we preferred to create a new project for better understanding.

 

Image showing the enteries for defining new Java Project

  • Click "Next" button, you see the following screen.

Image showing the Java setting for creating new Java Project

 

  • Check the "Allow output folders for source folder" option if you wish to have the class file for the HelloWorld.java

 


  • Navigate to "Libraries" tab. For this application we have used JRE 6, you select any other version of JRE if you wish.

 

Image showing selected Libraries while creating new Java Project

 

  • Click "Finish" button, you see the following screen.

Eclipse image after the successful creation of New Java Project

 


  • Next step will be to create HelloWorld.java file. Navigate to File/New/Class.

Image showing the creation of new Java Class file under Java Project

 

  • On selecting class option you see New Java Class pop-up. Here we will create the HelloWorld.java file with the default package.
  • One of the advantage of using IDE as the development tool is it helps you create code skeleton and comments, so you can spend your precious time doing other important things in life like fishing, long drives, dating ,etc. Wink

Eclipse image showing the declaration of New Java Class inside HelloWorld Project

 

  • Name (Name of the Java File): HelloWorld
  • Which method stubs would you like to create: Check "public static void main(String[] args)" option.
  • Do you want to add comments?: Check "Generate comments" option.
  • Click Finish to create the HelloWorld.java

Image showing the HelloWorld.java file

  • Now you have the stub of main method created. You are ready to edit the method as per your needs.
    Edit the main method to print "HelloWorld" as shown below.

Image showing the edited HelloWold.java file in Eclipse

 

 


  • Now to run the application right click on HelloWorld.java and select "Run As/Java Application" option.

Eclipse image showing the way to run HelloWorld.java file

 

  • On successful run you will see output as "Hello World" in console as shown below

Image showing the final result of HelloWorld.java

  • Wow! That's a magic. I got the output even without a class file.
  • No! This is not a magic. Behind the scenes eclipse compile the source java file and creates a class file in bin directory of your project workspace . Don't you believe? Check "C:\Documents and Settings\HelloWorld\workspace1\bin\"

So here is your entry to IDE world!

We use cookies

We use cookies on our website. Some of them are essential for the operation of the site, while others help us to improve this site and the user experience (tracking cookies). You can decide for yourself whether you want to allow cookies or not. Please note that if you reject them, you may not be able to use all the functionalities of the site.