Choose installation mode

There are three ways to install OCaml-Java:

  • using a precompiled binary distribution;
  • using project sources, manually;
  • using project sources, through OPAM.
The main advantage of using the source distribution is that the various tools are compiled as native programs, and are thus faster. However, in order to build the project, some tools need to be locally available, and the process is quite lengthy.

Warning! Except under MacOS X, it is necessary to have the JAVA_HOME environment variable set to the appropriate path in order to be able to build the project, and to compile sources through the ocamljava compiler.

  Install binary distribution

The binary distribution can be downloaded here.
Then, the installation is straightforward:
  1. unpack the archive;
  2. add the bin directory (unpacked from the archive) to the system PATH.

  Install from sources

The source distribution can be downloaded either as a source distribution, of from github.
In order to build the source, the following elements are needed:
  • a "decent" shell;
  • GNU Make 3.81;
  • Apache Ant 1.9.0;
  • JDK 1.7.
The other dependencies are shipped with the distribution.

The installation steps are:
  1. ./ -prefix path where path should be absolute;
  2. ./ (that builds and installs both OCaml and OCaml-Java);
  3. ./ (that deletes all the files produced by the build process).
The script also accepts an -ocaml-configure str switch that can be used to pass the str string to the configure script of OCaml. According to the prefix directory, it can be necessary to run ./ with root privileges.

  Install from OPAM

In order to install from OPAM, the following elements are needed:
  • a "decent" shell;
  • GNU Make 3.81;
  • Apache Ant 1.9.0;
  • JDK 1.7.
The installation is done by simply executing:
  1. opam remote add id url
  2. opam switch ocamljava-ver
  • id is any identifier (e.g. ocj);
  • url is;
  • ver is 2.0-alpha3.

  Check installation

Once installation is complete, it is possible to ensure that OCaml-Java can actually be used by executing ocamljava -v from the command-line. It should result in the following output:
The OCaml Java-bytecode compiler, version 4.01.0
OCaml-Java version: 2.0-alpha3
Standard library directory: /ocamljava-2.0-alpha3
About this site
© 2014-2015 Xavier Clerc
webmaster AT
Atom feed
Based on Bootstrap
Elements by Free Grunge Textures