Code editors / Development Environments
Follow the steps on this page to install Eclipse for editing Java code.
NOTE: As of Fall 2017, CIS 120 has adopted Codio as the editing platform for OCaml code. See our instructions for using Codio. Codio greatly simplifies the installation and configuration process.If you opt not to use Codio for editing OCaml code, we recommend one of the following options:
- Follow the steps on this page to set up Eclipse + OcaIDE
- Or: Emacs, Vim, or another standalone editor. Follow these instructions for setting up your environment from Real World OCaml (in particular, merlin tool)
CIS 120 Tools Setup
Eclipse
Step 1: Java Development Kit (JDK) 8
- To run Eclipse, a Java Runtime Environment (JRE)
must be installed.
You verify that you have the JDK 8 installed
by running the java -version command (from the
Command prompt in Windows or the terminal on Mac):
$ java -version java version "1.8.0_172" Java(TM) SE Runtime Environment (build 1.8.0_172-b11) Java HotSpot(TM) 64-Bit Server VM (build 25.172-b11, mixed mode)
You should see output similar to lines 2-4 above. Any higher version of Java will also work for this class.
- If you do not have the JDK 8 installed, you can download it from this site (after accepting the terms & conditions). Select the version for your OS from the table titled "Java SE Development Kit 8u191."
Step 2: Install Eclipse
We recommend using the latest version of Eclipse (Eclipse SimRel|2019-09 Edition), but earlier versions should work too. Make sure you have completed Step 1 before installing eclipse.
- Visit the Eclipse installer page.
-
Click on the link for your platform on the right side of the screen (under "Download")
and unzip the downloaded file to get a file called "Eclipse Installer".
- 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.
- Run the Eclipse Installer. Select "Eclipse IDE for Java Developers" and then "Install" to install Eclipse.
- Launch Eclipse.
-
The first time you run Eclipse, you need to choose a workspace (a folder that stores your projects).
Note: If you are using Eclipse for the OCaml part of the course, we recommend creating two fresh workspaces for CIS 120 projects. The first you can use for the OCaml part of the course, the second you should use for the Java part of the course.
Step 3: Project setup
Read the instructions for creating a new Java project in Eclipse.Eclipse + OcaIDE (after installing Eclipse)
Deprecated as of Fall 2017Step 0: (Mac Users Only) Install X11 Libraries
These are needed for the OCaml graphics libraries to work:
- Install Apple's XQuartz version, which is available here: http://xquartz.macosforge.org/landing/
- Before moving on to the next step, make sure you LOG OUT of your user account so that the X11 install can complete.
- 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, see the
instructions below.
Here are some steps to follow to resolve this sort of issue with the X11 dynamic libraries. If you encounter trouble with one of these steps, please post a question on Piazza, or come to TA office hours.
-
Open the terminal on your computer. It's located in
/Applications/Utilities/Terminal.app. You should see
a terminal prompt which looks something like this:
YourComputerName:~ YourName$
The $ is called a prompt, and you can type commands after it, then press return to execute them. - Verify that the X11 libraries exist by running the following
command in Terminal. Type or copy-paste the first line
(not including the dollar sign), and verify that after you press
return, the terminal prints out the second line.
$ find /opt -name libX11.6.dylib /opt/X11/lib/libX11.6.dylib
If something goes wrong here, make sure you installed XQuartz properly and restarted your computer. -
Now, make a new directory named lib in your home folder, and move into that
directory, by running the following commands (press return after each, and don't include the dollar signs).
$ cd $ mkdir lib $ cd lib
-
Create a symbolic link to the dynamic library in ~/lib.
$ ln -s /opt/X11/lib/libX11.6.dylib libX11.6.dylib
-
Verify that the symbolic link was created in that directory by running the command in the first line below. You should see output which looks similar to this.
$ ls -la $HOME/lib total 8 drwxr-xr-x 3 YourName staff 102 Jan 29 01:35 . drwxr-xr-x+ 36 YourName staff 1224 Jan 29 01:35 .. lrwxr-xr-x 1 YourName staff 27 Jan 29 01:35 libX11.6.dylib -> /opt/X11/lib/libX11.6.dylib
- Save any open files, and restart your computer.
-
Open the terminal on your computer. It's located in
/Applications/Utilities/Terminal.app. You should see
a terminal prompt which looks something like this:
Step 1: Install OCaml Version 4.01 or 4.02
We recommend:
-
Windows Users: Install the Windows-based binary
available here
ocaml-4.02.3-i686-mingw64-installer3.exe.
There are installation instructions on the web page
http://protz.github.io/ocaml-installer/
- You do not need any of the optional components (Emacs/ActiveTCL/Cygwin setup).
-
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 2: Install OcaIDE
OcaIDE is an Eclipse plugin for working with OCaml code.
- In Eclipse, click Help » Install New Software...
- In Work with, enter http://www.algo-prog.info/ocaide 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... » OCaml.
-
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 or C:\Ocaml\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. 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 3: Test the OCaml Graphics setup
You will now create a new Eclipse project and test that graphics are working.- Follow the graphics setup instructions.
- Once your computer shows the camel picture, you have completed setup! Show your recitation TA.