Eclipse is open source, free and easy to use IDE. This is most popular java IDE that is used in open source as well as commercial application. Eclipse is supported by many software companies like Borland, IBM etc. So learning eclipse can help you get the most out of your java development. Apart from java, eclipse can be used for C/C++ & PHP as well.
This article will give you overview of Eclipse IDE and common activities that can be done under the Eclipse environment.
Before you install eclipse on your machine you need to have Java JDK installed on your system. Current available version for java is 6, so you’ve to download JDK 6 from here. After successful installation of JDK, you’ve to install Eclipse.
Go to Eclipse website .Make sure you download the stable release from the download page of the website. After you download Eclipse, you will want to unzip the folder to anywhere on your computer, like C:/Eclipse/.There is no installation. Launch the program by clicking on the eclipse.exe executable which is at the top level of the Eclipse directory. You can place shortcut onto your desktop and then run it from there.
There are many Plug-ins & development packs available for eclipse. For example, QT jambi, XML, PDT and many others. You can browse through the eclipse website for more information about plug-ins.
Note: Installation of Eclipse in windows & in Linux varies. Check eclipse website for the instruction on how to get it for Mac OS X & Linux.
Creating Java project
There are many ways with which you can create java project.1. Select File > New > Project.Or 2. Select the (New) icon of the button in the upper left of the toolbar >Select Project.Or3. Select the (j+folder) icon from the upper toolbar.Or So finally Select Java project and click Next. This will open up the window with title “Create Java project“. At the top of the text field enter the name of the project. As far as JRE is concerned if you’ve multiple JRE on your system then select the one with which you wish to compile the project. Eclipse selects the JRE by default. So keep these settings as it is. If you want you can keep the src and bin folder separate. Select “Create separate source and output folders“, this will save a lot of headache later. Click Next to proceed further.
The next screen has four tabs: Source, Projects, Libraries, Order and Export. Source tab has all the options to let you add more source & output folders in your project. With project tab you can connect your java project multiple java project to your project. Libraries option allows you to select multiple JRE on your project. The order and export option sets the order in which project should be laid out & exported. If you’re new to these tabs just keep the default setting as it is. Click on Finish button this will open up empty class (with or without PSVM).Your new project will be displayed in java perspective.
Creating new class
To create a new class, select the File>New>Class command and respond to the resulting Dialog boxes. You must enter a name for the class in the Name text box. You can select or leave the package field blank, if you’re not using it. If you want main method & superclass constructor to be created then select it in the check box. Click Finish, this will create empty class with/without (constructor/main method).
a) Creating Java package
You can use any one of the following method to create new java package.
1. Select File > New > Package.Or
2. Select the (New) icon of the button in the upper left of the toolbar >Select Package.Or
3. Right click on a project in the Package Explorer view in the Java Perspective, and select Package.
Select a name for your package and click finish.Note: Make sure that you’re selecting the proper project & source folder.
b) Creating Java Interface
Similar to class and package, interface can be created in number of ways. So you can remember the simplest:1. Select File > New > Interfaceor
2. Select the (New) icon of the button in the upper left of the toolbar >Select Interface.
Give your interface a name, select the proper package that you want for interface needs to extend.Click Finish. The new Interface will be open in the editor.
To run an application, you must create a run configuration that specifies the class that contains the main method for the application. Eclipse offers you multiple ways of achieving this same thing. You can run your java program using following methods:1 Select Run > Runor2. Right click on the project you wish to run. Select Run > Java Application.Then select Java Application to run. This creates a run configuration for the application. The output is shown in the console window at the bottom most child window of the eclipse. To stop application from running you can click the terminate button.
If you want you can modify the default run configuration using Select Run > Java Application, then click the New button at the bottom left of the screen. This creates a new run configuration. You can then name the setting, browse & select the project. Enter the command line arguments if any in arguments tab. You can add more jar files in classpath tab. Once you done with it you can then click Run to run the program.
If you come across any problem or if you need help with eclipse, you can use eclipse DOCS. You can select the Help Contents or Search command from the Help menu. To search for a topic, enter a search string in the Search text box and click on the Go button. That will display a list of search results in the Search Results pane.
Eclipse community is the best place to get your questions answered. You can use following resources for more information on eclipse:
I hope the above information helps. If you’ve any more information that can be added or corrected here,then please don’t hesitate to post it here.