Guide to the Eclipse IDE - University of Cincinnati



Guide to the Eclipse IDE.

By Dan Hollingsworth, October 2005

Updated by Tao Ma, September 2011

A. Creating a project for Java.

1. Download and install Java SDK 7 from ORACLE at:



2. Download and Decompress Eclipse (no installer provided) at:

Download "Eclipse IDE for Java Develop" for general usage. Download " Eclipse IDE for Java EE Develop " for web based application.

5. To create a new project: File > New > Project > Java Project. Give a name to the new projet.

6. Right click project. New > Source Folder : "src"

7. Right click source folder. New > Package : "nameItAnything"

Note: Using packages is generally a good thing and keeps things organized.

8. Right click package. New > Class

9. The class is where you put your code. For Javadocs, enter "/**" and hit return just above whatever you wish to document (method/class/field).

B. Compiling/Building

1. Window > Preferences : type "jre"

2. In "Installed JREs" choose whatever folder Sun provided for the JDK. Don't select child folders such as the bin.

3. Hit the green (red for older version) play button in the toolbar. Choose "Java Application" then point it to your main class. Run. A testing code can be found at:

4. To debug, enter a break point in the code by double clicking the grey area in the left margin. Hit the bug next to the play button.

5. Hit the green/red power button on the console tab to end the application if you have not yet set the JFrame's defaultCloseAction(JFrame.DISPOSE_ON_CLOSE)

===============Note: section C needs updating====================

C. Getting Sun's Javadocs (optional)

1. Download the sourcecode to Java from about halfway down the page: "Download JDK 5.0 Source via..."

2. In your project's JRE System Library, right click rt.jar, Properties : Java Source Attachment : External File/External Folder. Find the source folder or archive and select it.

3. Mouse over anything built into Java and you will have its javadoc. On auto-complete (ctrl-space) you will also have them.

==================================================================

D. Tips/Tricks

1. Put the mouse over a method or member instance and hold control then click. You will be taken to where it was created.

2. Look for the lightbulbs in the left side grey margin, they will often correct your code and write try/catches and add unimplemented methods from inherited classes.

3. Take advantage of the source and refactor menus (which have rename, format, and organize imports).

4. Set up your own code formatter by typing "formatter" into the preferences window.

5. Right click a file and choose Compare To > Local History

6. Perhaps use the built-in CVS frontend if you're using CVS. Eclipse's interface should be sufficient for this project.

Good luck,

Dan

hollinde@email.uc.edu

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download