OCaml and Java

Discussion page

This is a discussion page so please add your comments below.

FFI libraries

Xavier Leroy's CamlJava describes itself as a very preliminary attempt to interface OCaml with Java. It does this indirectly via C and the JNI.

Chailloux and Henry's O'Jacaré builds on this to provide an object-oriented interface.

Javalib

Nicolas Cannasse's JavaLib allows OCaml programs to read in Java .class files and parse out the structures they contain.

It requires an additional JVM in order to be able to run the bytecodes found in the class files however.

OCaml-Java

The goal of the OCaml-Java project is to allow seamless integration of OCaml and Java either by interpretation or compilation.

Cadmium is a Java port of ocamlrun, while Cafesterol provides an ocamljava compiler that is a counterpart of ocamlc/ocamlopt that generates Java bytecode.

Nickel is a bridge generator that produces glue code for easy access to Java instances from the OCaml side.

OCamlScripting is an implementation of the Java JSR223 Scripting API (this API is defined by the javax.script package) for OCaml. It thus provides a script engine that allows execution of OCaml code snippets in a Java application.

Javacaml

A O'Caml bytecode interpreter for Java. Note: it is no longer maintained, but may be of interest for understanding Ocaml bytecode.