Open ghost opened 9 years ago
What steps did you take beyond the environment variable to install it? In particular, are the jar files located in C:\ or elsewhere? It needs to read from it's own library and it can't find what I think is probably the ocaml-lib-files.jar In the installation lib directory, there is a jar embedded in it equal to the missing resource:
$ jar tvf ocaml-lib-files.jar | grep jar 1175509 Tue Jul 01 07:46:30 EDT 2014 ocamljava-2.0-early-access12/lib/ocaml/ocamlrun.jar
If you move the installation to C:\ it might work. I myself have similar loading issues when trying to separate the jars into different folders (issue #3).
I only set JAVA_HOME and my PATH like this in a batch file, and start jEdit:
set JAVA_HOME=E:\E_2\jre7-64
set PATH=%JAVA_HOME%\bin;%PATH%
set PATH=C:\ocamljava_v2.0-alpha2\bin;%PATH%
I put it on C like shown here, but it doesn't work:
C:\ocjtest> echo %JAVA_HOME%
E:\E_2\jre7-64
Process echo exited with code 0
C:\ocjtest> which ocamljava.bat
C:\ocamljava_v2.0-alpha2\bin\ocamljava.bat
Process which exited with code 0
C:\ocjtest> cat hello_world.ml
print_string "hello world!\n";;
Process cat exited with code 0
C:\ocjtest> ocamljava.bat -o hello_world.jar hello_world.ml
File "hello_world.ml", line 1:
Error: Error during linking:
unable to open archive ("\\ocamljava-2.0-alpha2\\lib\\ocaml\\ocamlrun.jar")
I change to ocamljava-2.0-early-access11
, and it works, and the jar executes:
C:\ocjtest> which ocamljava.bat
C:\ocamljava-2.0-early-access11\bin\ocamljava.bat
Process which exited with code 0
C:\ocjtest> ocamljava.bat -o hello_world.jar hello_world.ml
Process ocamljava.bat exited with code 0
C:\ocjtest> java -jar hello_world.jar
hello world!
Process java exited with code 0
Your error message is what came up on a Google search, and brought me here. Thanks.
Ghost, I encounter the same problem as you did... did you solve the issue ?
Ghost, @kyoann
unable to open archive ("\\ocamljava-2.0-alpha2\\lib\\ocaml\\ocamlrun.jar")
set PATH=C:\ocamljava_v2.0-alpha2\bin;%PATH%
Your problem might be that
ocamljava_v2.0-alpha2 != ocamljava-2.0-alpha2
The hard coded path has to match up exactly.
Since I'had the same problem with alpha3
and just solved it, I'd share:
You go to \\ocamljava-2.0-alpha3\\lib\\
and there you'll find a file ocaml-lib-files.jar
. Open it with 7zip
and cope the ocaml
folder to lib
Now you can link hello-world.jar
and it runs
First, thanks for a Java version of OCaml. For months I've been trying to find one programming language that's a good compromise between a number of things: functional, to go along with theorem proving, but with the potential for more easily tapping into parallel programming. I noticed your ForkJoin, MapReduce, etc., and since OCaml-Java is tied into Java, there's the possibility of Jcuda.
Now the problems. The second problem is the important one.
An easy problem is that the batch files don't work if there are spaces in the path. That's because there are no quotes around the jar file argument. A normal line looks like this:
"%OCJ_JAVA%" -Xss8M -jar %~dp0/../lib/ocamlc.jar %*
It's not a problem, really. I just put the argument in quotes.
The reason I'm submitting this is because
ocamljava
gives the following error due to linking:E:\E_1\02-p\1o_jv_w rk_test> ocamljava -o "E:\E_1\02-p\1o_jv_w rk_test\hello_world.jar" "E:\E_1\02-p\1o_jv_w rk_test\hello_world.ml" File "E:\E_1\02-p\1o_jv_w rk_test\hello_world.ml", line 1: Error: Error during linking: unable to open archive ("\ocamljava-2.0-alpha2\lib\ocaml\ocamlrun.jar")
Here is some additional information.
ocaml
,ocamlc
, andocamlrun
, which are the only other commands I've used.ocamljava-2.0-alpha1
.ocamljava-2.0-early-access11
.Thanks.