CIS 120

caml | java api | piazza | | directories | portal | van pelt library | engineering library
dining philosophers (DP) | science & tech wing (STWING) | women in cs (WICS)
CETS Answers |

OCaml, Eclipse and OcaIDE Setup

You may skip "Install OCaml" and "Install Eclipse" if working on SEAS lab machines.

  1. Install OCaml
    • Visit INRIA download page.
    • Download and install "Precompiled binary for <your platform>." If you're running Windows, use the "Microsoft-based" binary.
  2. Install Eclipse
    • To run Eclipse, a Java Runtime Environment (JRE) must be installed. You can check if Java is installed on your machine.
    • Visit Eclipse download page.
    • Click on the link for your platform and install it by simply unpacking the downloaded file onto your desktop.
    • Launch Eclipse. The first time you run Eclipse, you need to choose a workspace (a folder that stores your projects). Use the default location that Eclipse suggests, or choose your own location.
  3. Install OcaIDE
    • In Eclipse, click Help » Install New Software...
    • In Work with, enter then click Add, OK.
    • 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.
    • Click Restart Now. After Eclipse restarts, close the Welcome tab and click Window » Open Perspective » Other... » O'Caml.
    • 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 O'Caml Binaries Directory and choose the "bin" directory inside your O'Caml 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.
    • 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.
    • Click the "Ocaml Toplevel" tab at the bottom of the workspace. 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.