CIS 120: Programming Languages and Techniques I
Fall 2015

CIS 120 Tools Setup

Step 0: (Mac Users Only) Install X11 Libraries

These are needed for the OCaml graphics libraries to work:

  1. Install Apple's XQuartz version, which is available here: http://xquartz.macosforge.org/landing/
  2. Before moving on to the next step, make sure you LOG OUT of your user account so that the X11 install can complete.
  3. Check to see that the directory /usr/X11/lib exists and that it contains the file libX11.6.dylib (this should have been created when you installed XQuartz). If this isn't the case, try reinstalling XQuartz and then contact the course staff for help.

Step 1: Java Development Kit (JDK) 7

  1. To run Eclipse, a Java Runtime Environment (JRE) must be installed. This will already be the case on most modern machines, but you can use this link to check if Java is installed on your machine.
  2. If the link above does not work (under Chrome, for example), you can alternatively verify that you have the JDK 7 installed by running the java command (from the Command prompt in Windows or the terminal on Mac):
    ~cis120/> java -version
    java version "1.7.0_71"
    Java(TM) SE Runtime Environment (build 1.7.0_71-b14)
    Java HotSpot(TM) 64-Bit Server VM (build 24.71-b01, mixed mode)
          

    You should see output similar to that above indicating a Java version 1.7.*

  3. If you do not have the JDK 7 installed, you can download it from this site (after accepting the terms & conditions).
Note: Make sure you do this step before installing Eclipse or OCaIDE.

Step 2: Install OCaml Version 4.01

We recommend:


  • Mac Users: Install the OS X version ocaml-4.01.0-intel.dmg.
    • This distribution works with OS X 10.7.5 and later. If you have an earlier version, contact the course staff for help.

Step 3: Install Eclipse

We recommend using the Eclipse "Mars" release version 4.3, but earlier versions should work too.

  1. Visit the Eclipse download page.
  2. Click on the link for your platform on the right side of the screen and install it by simply unpacking the downloaded file onto your desktop.
    • Note: The 64-bit Windows version of Eclipse may not be able to locate Java installations. If this happens, use the 32-bit Windows version instead.
  3. Launch Eclipse.
  4. The first time you run Eclipse, you need to choose a workspace (a folder that stores your projects).
    Note: We recommend creating two fresh workspaces for CIS 120 projects. The first workspace you should use for the OCaml part of the course; the second you should use for the Java part of the course. You can create the second workspace at any time.

Step 4: Install OcaIDE

OcaIDE is an Eclipse plugin for working with OCaml code.

  1. In Eclipse, click Help » Install New Software...
  2. In Work with, enter http://www.algo-prog.info/ocaide then click Add, OK.
  3. Check OcaIDE and click Next, Next, I accept, Finish to accept the license and install the software. Eclipse will prompt you to accept unsigned code.
  4. Click Restart Now. After Eclipse restarts, close the Welcome tab and click Window » Open Perspective » Other... » OCaml.
  5. Go to Window » Preferences (Mac OS X users, go to Eclipse » Preferences). Click on "+" or "▶" next to OcaIDE to expand the tree and then click on Paths. If all the paths in this panel (except for possibly make and omake) are already filled in, then continue to the next step. Otherwise, click Browse next to OCaml Binaries Directory and choose the "bin" directory inside your OCaml installation directory (for example, C:\Program Files\ObjectiveCaml\bin). Then press Apply. Eclipse should fill in additional path values for you (ocaml, ocamlc, etc).
    • Under Other tools » OCaml lib path, click Browse and choose the "lib" directory inside your ObjectiveCaml installation directory. Press OK to close the dialog.
  6. Near the top right of Eclipse, you should see an OCaml button and Java button, with the Ocaml button selected. If you only see the Java button, click the button to the left which looks like a window with a yellow "+" sign, and then double click on "OCaml". Now you are in OCaml mode.
  7. Click the "Ocaml Toplevel" tab at the bottom of the workspace. You should see the OCaml output display:
    	OCaml version 4.01.0
    
    	#
          
    Type into the prompt (do not type next to the #; the prompt box is at the bottom of the tab):
    print_endline "hello world";;
    You should see the output:
    hello world
    	- : unit = ()
    If this doesn't work, ask a TA for help.

Step 6: Set up OCaml Graphics

You will now create a new Eclipse project and test that graphics are working.
  1. Read the instructions for creating a new Eclipse project.
  2. Follow the graphics setup instructions.
  3. Once your computer shows the camel picture, you have completed setup! Show your recitation TA.