xclerc / ocamljava

http://www.ocamljava.org
Other
172 stars 14 forks source link

ocamljava error during linking on Windows; ocaml, ocamlc, & ocamlrun all work #13

Open ghost opened 9 years ago

ghost commented 9 years ago

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.

It's not a problem, really. I just put the argument in quotes.

Here is some additional information.

Thanks.

struktured commented 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).

ghost commented 9 years ago

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.

kyoann commented 8 years ago

Ghost, I encounter the same problem as you did... did you solve the issue ?

struktured commented 8 years ago

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.

vrotaru commented 6 years ago

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