CS 201 - Installing Java and Eclipse

If you want to run Java and Eclipse on your own computer, here's what to do:
  1. If you haven't already, install the Java JDK (Java Development Kit), version 1.8 ("Java 8"). Do not install newer versions (Java 9, 10, or 11) - this will cause problems with Bailey's package and also when running your final project applets on the web.

    Download JDK 1.8 here. (If that link doesn't work, download the JDK 1.8 from the Java SE Downloads page). Click the download button for "JDK". Follow the instructions there and all should be well. Remember whether you installed the 32-bit or the 64-bit version (either will work, when in doubt use the 64-bit version).

  2. Download and install Eclipse from http://www.eclipse.org/downloads/. Download the Eclipse Installer and select 32 bit / 64 bit to match your version of Java. Once you run the installer, select "Eclipse IDE for Java Developers".

  3. Start Eclipse by double-clicking on it. On a Mac you might need to hold down the control key while clicking Eclipse in order to get it to run the first time. When asked to select a workspace, use the default value. Do not change the workspace to your cs201 folder or your current HW folder.

  4. [Optional, and will only for for Java 8, not for Java 9 or 10.] If you want to use Bailey's structure or structure5 package, download bailey.jar from here, and save it somewhere on your computer. If you have a Mac, the simplest option is to store the file where the java compiler will find it. Follow these instructions:

    To use Bailey's structure package on your own Mac, open the Finder, select "Computer" from the "Go" menu, and put the file into

    Computer / Macintosh HD / Library / Java / Extensions
    The other option (for any computer) is to store bailey.jar in a permanent location, e.g., your cs201 folder or within the Eclipse installation folder, then tell Eclipse where to find this file:
    • Start Eclipse.
    • Open the Window menu and select Preferences. (On Macs, Preferences is found in the main Eclipse menu.)
    • 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 BAILEY. Be sure to spell it exactly like this and in all capitals.
    • For the Path, click the File button and find the bailey.jar file you just downloaded.
    • Click OK and OK again.

    Now, if you want to use Bailey's structure package in a project:

    • Open the project and select "Project Properties"
    • Select "Java Build Path",
    • Select the "Libraries" tab
    • Click on "add variable" and select BAILEY.

That's it!

Creating new projects

For most of the assignments, we will provide zip files that already contain Eclipse projects, which you then "import" into Eclipse as in HW 4. However, if you ever want to create a new project from scratch, here's how:
  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 Bailey's structure or structure5 package, or if you have saved it in the Extensions folder as described above, you are all done. Click Finish and skip the rest of the steps. Otherwise, if you've defined the BAILEY variable as described above, click Next.
  5. Select the "Libraries" tab.
  6. Click "Add variable".
  7. Select BAILEY from the list and click "OK".
  8. Click "Finish".

Credits: Part of these instructions were derived from a handout at Pomona