Project creation and configuration steps on Eclipse editor
- Download the Eclipse installation file (in zip format) from following URL ‘http://www.eclipse.org/downloads’ for MS windows version.
- Unzip the downloaded zip file and get the eclipse folder.
- Under eclipse folder you will get eclipse executable file ‘eclipse.exe’
- Click on ‘eclipse.exe’ it will open the Eclipse Workspace Launcher.
- Click on ‘Browse…’ button and select a workspace for your project and click on ‘OK’ button, it will open the Eclipse editor. Close the welcome window of editor.
- Right click on left pan of editor window (package Explorer pan) and select ‘NewJava Project’
- It will lead you to ‘New Java Project’ Window. Enter a project name into ‘Project Name’ input box. Choose ‘Create project from existing source’ radio option and click on ‘Browse’ button.
It will open the below window from there you select your project base (in my case it is D:\stars\implementation\software\testing) and click on ‘OK’ button.
It will populate ‘Directory’ input box with code base location path.
Now click on ‘Next’ button of ‘New Java Project’ window. Following window will get appeared.
Now you need to change the value of ‘Default output folder’ input box and for the same click on ‘Browse…’ button and select classes folder within your project base (in my case path is ‘ stars/web-inf/classes’) and click OK button.
It will populate ‘Default output folder’ input box with selected value (in my case it is ‘stars/web-inf/classes’).
Now click on ‘Finish’ button, it will create a project in Eclipse with existing code base. That you can see in the left pan (Package Explorer pan) of Eclipse editor.
- Next you need to configure build path for the created project and for the same right click on created project and select ‘Properties’.
- It will open a window with created project name (in my case it is ‘Properties for stars’). Now click on ‘Java Build Path’ and see right pan of the opened window. Three is four buttons (Sources, Projects, Libraries and Order and Export).
- Click on ‘Source’ button it will show your source code folder (in our case it is ‘java’ folder that contains all java classes). Click on ‘Source’ button will show you the other projects that are already created in the same workspace. ‘Order and Export’ pan there you can arrange the content into order and also you can export them.
Click on ‘Libraries’ button and add required jars in your application’s build path for compilation and execution of your source code. You can see right side of ‘Libraries’ pan there are two buttons one is ‘Add Jars…’ and other is ‘Add External Jars…’. Through add jars option you can add your application jars that is present into lib folder to project build path and through add external jars option you can add external jars that is not part of your application.
So click on ‘Add Jars…’ button and select all required jars from lib folder and click OK button.
It will populate the ‘Libraries’ pan with selected jars.
Now click on ‘Add External Jars…’ button and select required external jars for your project from local directory.
Basically some jars for application execution is already bundled with application server (JRun) and those jars we are not generally keeping into the lib folder of application and for compilation of the application we add them as external jars.
- Now you can see all added jars into ‘Libraries’ pan of the opened window.
Next you click ‘OK’ button. It will add all the added jars into the project build path and will close the ‘Properties for stars’ window.
- Now clean the java compiled classes and recompiles it. For the same select ‘Projectclean’ and also check ‘Build automatically’ option.
- If ‘Problems’ pan is showing any errors, it mean compilation has failed. Click on error, it will open the java source code where error occurred.
- For opening a source code file into editor, just double click on it. It will get opened.
- If there is any error in the source file then editor will show it with red mark. Put mouse over it and see the cause of error. After fixing the error, press ‘Ctrl+s’ on your keyboard to compile the same file.
- Double click on the file name. Editor will expand the source code window in full screen and again double click on same it will return back to previous window.
- To create a new java class go to ‘starsNewclass’
It will open the ‘New Java Class’ and there you should enter the class name as well as package name for new class and click ’Finish’ button. It will create a new java class in the mentioned package. For other file type apart from classes do the same and choose other suitable option from ‘New’.
- For searching a word into source code press ‘Ctrl+F’.
- For searching a word in whole project press ‘Ctrl+H’.
- Select a method in a class and press ‘Ctrl+Shift+G’, it will show you all the classes from where this method has called.
- Select object or its method of other class and press ’Ctrl+Enter’, it will open that object’s source file in Eclipse editor.
- To plug-in the HTML Editor with Eclipse, download following jar ‘tk.eclipse.plugin.htmleditor_2.0.6.1.jar’ and place it into your Eclipse ‘plugins’ folder (in my case it is ‘D:\Program Files\eclipse\plugins’).