The Eclipse Environment

  Follow * this * link; select "download", choose "Eclipse IDE for Java Developers", and download the file for your O/S (Windows, Linux, and Mac OS X are all supported, with 32 and 64 bit width).  
  Extract all files from the downloaded archive into a directory. Under Windows, it is recommended that you extract to C:\Program Files. This will store them in C:\Program Files\eclipse. One of these files is an executable (eclipse.exe in the case of Windows). Create a shortcut to it and place it on your desktop.

Follow these steps carefully in order to configure Eclipse:

  1. The Shortcut:
    One directory (folder) in your hard disk will be designated as your Eclipse workspace. When you create a new project, it will appear as a subdirectory of this workspace. A project is a collection of related Java classes. Follow these steps to set the workspace:

    1. Decide on a directory to become your workspace. It is a good idea to choose one outside Eclipse's program directory so that it wont be overwritten if you upgrade to a new release of Eclipse. We recommend using your home directory under Linux or your My Documents directory under Windows as your workspace. Let x be the full name of that directory, e.g.
        x = "C:\Documents and Settings\hr\My Documents"
    2. Find out where your Java development kit is located (the one in which you stored type.jar). For example, it could be in C:\Program Files\Java\jdk1.6.0_20. Let y be this full path.

    3. Modify the shortcut created earlier by adding the following arguments to the target:
        -vm y\bin\javaw.exe -data x
    4. Launch Eclipse from the modified shortcut.


  2. Configure Eclipse:
    Close the welcome window (it appears only the first time you launch Eclipse).
    1. Select "Open Perspective" from the Window menu and select "Java".
    2. Familiarize yourself with the GUI: an explorer in the left frame, the editor and the console in the middle, and an outline in the right frame.
    3. Select "Preferences" from the Window menu. Click on the + next to Java and then on the + next to Code Style. Click on Formatter.
    4. In the Formatter screen, click the "Show..." button and select the "Braces" tab.
    5. Change all the shown selections from "Same line" to "Next line".
    6. When you click on OK, enter "York" (or any other name) as the profile name.
    7. Click OK until you return to Eclipse.

  3. The First Project:

    1. Decide on a name for your first project. If you are using the "Java By Abstraction" textbook then call it echeck. Otherwise, you may want to call it after your course number, e.g. cse1010.
    2. From the File menu of Eclipse, select "New" then "Project"; specify that it is a "Java" project; and click "Next".
    3. In the project dialog, enter a name for your project.
    4. Click "Finish".

  4. The First App:

    1. Right-click the project name in the explorer and select "new class". You may want to check the box that asks Eclipse to add a main method for you.
    2. Note that compilation is done as you type.
    3. Save your work.
    4. Drop the run button (on the toolbar) and select that you want to run this as a Java Application. You do this only the first time you run an app. After wards, this will be part of the run button's list. the

  5. Set up eCheck:
    From the Run menu, select "External Tools" then configure the tool. Select "Program" in left pane and click the "New" button at the bottom of the pane. Fill the right pane (only its Main tab needs to be filled) as follows:

    Name eCheck
    Location Click Browse File System... and navigate to the JDK's bin directory and select java.exe The result would be something like:
    C:\Program Files\Java\jdk1.6.0_20\bin\java.exe
    Working Directory     Click Cariables and choose the Workspace Location and the project name. Nest these two so the working directory would be the source folder of the selected project. The result would be something like:
    ${workspace_loc:${project_name}/src}.
    Arguments type "eCheck", followed by a space, and then click "Variables..." and select the name of the selected resource". The result should be:
    eCheck ${selected_resource_name}

    Click "Apply" then "Close".

  6. Set up Options:
    From the Run menu, select "External Tools" then "External Tools...". Select "Program" in left pane and click the "New" button at the bottom of the pane. Fill the right pane (only its Main tab needs to be filled) as follows:

    Name Options
    Location Click Browse File System... and navigate to the JDK's bin directory and select javaw.exe The result would be something like:
    C:\Program Files\Java\jdk1.5.0\bin\javaw.exe
    Working Directory     Leave it blank
    Arguments type "Options"

    Click "Apply" then "Close".

Eclipse is now set up and ready to be used.

Eclipse has many features (and can be extended by plug-ins) but it is essential that you first become comfortable with its basic features and then explore other features as needed. As such, it is recommended that you always use the Java Perspective and in it expose only the following views: editor, console, and navigator. It is recommended that you position the navigator so that it occupies the left edge of you screen (as a frame) and leave the remainder of your screen for the editor (on top) and the console. Close any other view that Eclipse shows (see the snapshot below). Once you become comfortable with the basic features, you can explore the more sophisticated ones, e.g. debugging, javadoc generation, JUNIT, and Re-Factoring.

You type programs in the editor and it gets compiled incrementally; i.e. as you type it. If no syntax errors are present, you can run it by clicking the "running person" icon. The first time you run it, you must specify that it should run "As an Application".

You can run eCheck or Options from the next icon (it shows a red toolbox). Again, the first time you run it, you must drop down the menu, choose External Tools, and click the Run button, but afterwards, you will find its name listed in the red tool icon.

The following image shows how the Eclipse screen should appear (in the Java Perspective) after choosing the above-mentioned views.