2013-12-17 161 views
3

我是Ocaml-java(或Cafesterol)的新用户,它将原生Ocaml程序编译为允许在JVM上运行的可执行jar。然而,当我尝试编译测试程序转换成可执行的JAR我得到错误信息如下:未能链接到标准库的Ocaml-java(或Cafesterol)

>java -jar ~/ocaml-project/ocamljava-bin-1.4/bin/ocamljava.jar -standalone regexdna.ml -o   regexdna.jar 
File "regexdna.ml", line 1, characters 0-1: 
Error: No implementations provided for the following modules: 
    Str referenced from regexdna.cmj 
    Unix referenced from regexdna.cmj 

看来模块海峡和Unix从Ocaml程序编写的Java失踪。然而,当我安装Ocaml-java时,str.jar和unix.jar确实存在于〜/ ocaml-project/ocamljava-bin-1.4/lib/others /目录下,并且在这些jar中我们有Str.class和Unix.class。 (我想这个目录是Ocaml-java标准库的路径,所以它应该包含在默认搜索路径中)

任何Ocaml-java用户都可以告诉我Ocaml-java如何搜索依赖库吗?

回答

0

在此引用泽维尔克莱尔:

那么它应该工作,但你必须明确地通过引用 库(就像在香草OCaml的)。领导你的情况来:

$ /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java -jar ~/opt/ocamljava-2.0-early-access9/lib/ocamljava.jar str.cmja regexdna.ml 

请注意,我使用的是最新的ocamljava预览。