CS 2110 - Eclipse TipsEclipse is going to be the IDE (Integrated Development Environment) of choice for this course. Go ahead and get it now, but you're not required to use it until Homework 1. If you want to use JCreator or DrJava at first, that's fine.
We have already put together some Eclipse distributions with the plugins needed for this class. (These are now updated for 2010-2011!) You may download them here:
- Mac: http://www.cs.virginia.edu/~cs201/eclipse-mac.zip
- Win: http://www.cs.virginia.edu/~cs201/eclipse-win.zip
- After downloading one of these copies, go to Step 5 below.
- First be sure that you installed an up-date-date version of the Java SDK (as above)
- Visit external link: http://eclipse.org
- Click on the orange "Download Eclipse" button
- Click on Eclipse IDE for Java Developers link for your operating system.
- What you get, specifically, when you download Eclipse is in fact a zip file. To "install" Eclipse, open the zip file and "extract" the files inside it into a new directory.
- You can put this new directory anywhere you like (or move it after you unzip it). For Windows users, you can put it into C:\Program Files or C:\Eclipse or anywhere else. For Mac users, you can put it in Applications or anywhere else.
The Java code you write will be stored in a separate directory that's called a "Workspace." Make sure you keep up with where you make your Workspaces!
A Workspace can contain more than one "Project".
- A Project usually corresponds to a single program, so you might have a Projects namd Homework0, Homework1, etc.
- A Project organizes your Java files, and Eclipse also adds some other files and folders that it needs and that make things work better.
- To move your "program" from one machine to another (e.g. from a UVa lab machine to your personal PC), you need to package up the entire Project and then reload it on the other machine.
- The simplest way is to "Export" a project as a Zip file, then "Import" it on the new machine.
Warning! You should never run Eclipse on a lab machine with your Workspace set to a folder on UVa's Home Directory (i.e. the K:\ drive)! This will seem to work for a while, but it will fail and you will likely lose all of your work.
To do this:
- Right-click on your project in the Project Explorer and choose Export.
- Choose General->Archive File. Click Next.
- In the "To archive file:" field, use the Browse button to find a location to save your zip file and to give it a name.
- Finally, push Finish. The zip file is where you told it to save.
To do this:
- Download the zip file from the link and save it somewhere on either your local or net drive.
- Once you have your Eclipse workbench open, select File -> Import.
- In the pop-up window, select to import a General -> Existing Projects into Workspace and press Next.
- Choose "Select Archive File" (i.e. from a zip file) and choose Browse and find the zip file you downloaded.
- Finally, push Finish.
Note: You can't import a project if one already exists with the same name. If you do have one with the same name that you want to keep, you can delete it or rename it before importing. Right-click on the project in the Eclipse Package-Manager, and choose Delete or Refactor->Rename.