Important Note:
Compilation as described here probably only works on UNIX platforms.
As I have no experience with Windows systems it is possible that
there is somewhere UNIX specific code.
You need the following files and tools to be able to compile for JavaCaml:
- The javacaml library. It is distributed as a directory containing
some (binary) files ending with .cmi, some (text) files ending
with .mli and a (binary) file javacaml.cma.
- The javacamlrun wrapper. This is simply a binary executable.
To compile sources you must use the ocamlc command without the
-custom switch, and include the following additional options:
- Include -I followed by the directory containing the javacaml
library files.
- Include -use_runtime followed by the file name of the javacamlrun
wrapper.
Example: To compile the source t.ml use the following command:
ocamlc -I /usr/local/lib/ocaml/javacaml
-use_runtime /usr/local/lib/ocaml/javacaml/javacamlrun
-o t
t.ml
The result is written into the file t. If you have a working Java
runtime system, you can simply execute t which is then run in the
JavaCaml environment.
Running the compiled executable as stand-alone application
As already mentioned, the bytecode file finds automatically its Java
runtime system (at least on UNIX platforms). If this does not work,
try the following:
java ocaml.Exec Name_of_bytecode_file
If this command does not find the "java" executable, check your
PATH. If it does not find the "ocaml.Exec" class, check your
CLASSPATH. Change the values entered in the javacamlrun configuration
section and compile this tool again.
Running the compiled executable as applet
See how to install JavaCaml on a Web
server.