The goal of the project is to provide seamless integration of OCaml and Java: run OCaml code on a JVM, and manipulate Java entities from OCaml.



  100% OCaml, 100% Java

The compiler supports the whole OCaml language (version 4.01.0), and generates plain Java bytecode. Moreover, the runtime support library does not use native code. Produced jar files can thus be run on any 1.7+ JVM.

  Applications, applets & servlets

The default behavior of the compiler is to generate standalone applications, but the developer can use alternative compilation and link modes in order to produce applets (to be run inside a browser), or servlets (to be run inside a servlet container).


The compiler features a typer extension allowing to manipulate Java entities from OCaml code. Java instances are thus given proper types in OCaml programs, enabling complete typing of instance creations, method calls, and field accesses.


The generated code usually runs faster than OCaml bytecode but slower than native code. Memory consumption and startup time are also higher, but leveraging the multiple cores of a machine can help reaching the performance level of native code.


The runtime library does not rely on a global lock, and takes advantage of the Java GC to enable shared-memory concurrent programming. Furthermore, Java basic building blocks such as fork/join are presented through an OCaml interface.


The compiler as well as associated tools and libraries can be fully installed through OPAM. A patched version of findlib is also available, allowing to easily distribute and use code to be compiled with the OCaml-Java compiler.

About this site
© 2014-2015 Xavier Clerc
webmaster AT ocamljava.org
Atom feed
Based on Bootstrap
Elements by Free Grunge Textures