Eclipse Installation and Use

For Pomona CS 51 Students

This document answers questions particularly related to the use of Eclipse in CS 51 at Pomona College. The official Eclipse FAQ is available from

  1. How do I install Eclipse on my own computer?
  2. How do I create a new project?
  3. How can I add a class to a project?
  4. How can I add an image or sound file to a project?
  1. How do I install Eclipse on my own computer?

    There are several things you need to do to install Eclipse on your computer:

    1. Install the Java JDK (Java Development Kit). It may already be installed on your computer. Type "java -version" (without the quotes) in a terminal window. If it prints java version "1.8.x" (where x can be anything) then all is well. If not (it prints an error message, or java version 1.7 or earlier, or you can't figure out how to do this), download and install Java from Follow the instructions there and all should be well. You will need both the jdk and jre.
    2. Download and install Eclipse from Any version that just supports Java is likely to be fine.
    3. Download objectdraw.jar from Remember where you download this because you will need to tell Eclipse where it is.
    4. Start Eclipse by double-clicking on it. On a Mac you might need to hold down the control key while clicking Eclipse inorder to get it to run the first time -- this is a new "security" feature.
      • Open the Window menu and select Preferences.
      • Click on the icon to the left of "Java" to expand the Java choices.
      • Expand Build Path and then select Classpath Variables.
      • Click the New button.
      • For the name, enter OBJECTDRAW. Be sure to spell it exactly like this and in all capitals.
      • For the Path, click the File button and find the objectdrawV1.1.2 file you just downloaded.
      • Click OK and OK again.

  2. How do I create a new project?

    1. Open the "File" Menu. Select "New" and then "Project" from the submenu.
    2. Select "Java Project", which may be showing at the top level or you may have to open the Folder labeled "Java" to find it, and then click "Next".
    3. Enter the Project name.
    4. If you are not planning to use objectdraw, click Finish and skip the rest of the steps. If you are planning to use objectdraw (the usual case), click Next.
    5. Select the "Libraries" tab.
    6. Click "Add variable".
    7. Select OBJECTDRAW from the list and click "OK".
    8. Click "Finish".

  3. How can I add a class to a project?

    First you should make sure the project you wish to add the class to is selected in the Package Explorer. Then there are two options. You can open the "File" menu, select "New" and then "Class" from the submenu. Alternatively you can click on the "C" icon just above the line separating the "Package Explorer" and "Editor" panes. You can also use the menu next to the "C" to select "Interface" if that is what you want to create.

    When a new dialog box appears, make sure that the name of the project is listed as the "Source folder". If not, use the browse button to find the correct project. In the "Name" field, type the name of the new class. While you can add information in the "Superclass" and "Interfaces" fields, it is often simpler just to add it yourself after the class has been created. Click on "Finish" to finish creating the new class as part of your project.

  4. How can I add an image or sound file to a project?

    The following technique can be used to import any type of file into an Eclipse project, not just image and sound files. The files will be copied into the project.

    1. Select the project to import the file(s) into in the Project Explorer panel.
    2. Open the File menu. Select Import. Select File system. Click Next.
    3. Click the Browse button. Find the folder containing the files to import. Select Choose.
    4. Click on the folder name (not the check box) in the left column.
    5. Select the files to import in the right column.
    6. Click Finish.