Hi, list.
I am also looking for a way to use Java library in OCaml application. My OCaml
application is performance-critical static source code analyzer. I found two
options: X. Clerc's OCaml-Java and X. Leroy's camljava. Which one is more
suitable?
1. OCaml-Java
From my understanding, OCaml-Java[1] compiles OCaml code into byte code and
packs the byte code, interpreter, and Java code into one Java application. It
looks more like embedding OCaml code in Java, not getting some help from
Java. So it does not satisfy my pro-OCaml taste. I am also concerned about
slowdowns due to byte code and interpreter.
2. camljava
I think camljava[2] is more suitable for my purpose. Using camljava, I can
launch JVM and call Java methods via JNI from native OCaml applications.
However, it is a very low-level interface so that I need to implement many
boilerplates by hand (O'Jacaré[3] might reduce some burden?) and beware of
type-safety. Also, it is not maintained for a long time (the latest
version came out before ten years ago).
Do you have any suggestions? Moreover, could anyone share some real-world
stories about OCaml-Java binding?
Regards,
Seungcheol Jung
[1]
http://www.ocamljava.org/[2]
https://forge.ocamlcore.org/projects/camljava/[3]
http://www.pps.univ-paris-diderot.fr/~henry/ojacare/index.en.html