I am porting an application that works in linux to Windows. The application uses libjvm to start a Java virtual machine and run some Java classes that interoperate with main code written in C++.
I have installed JDK1.8.0_60, and Visual Studio 2010.
I set the following properties under Configuration Properties -> VC++ Directories
Include Directories:
C:\Program Files\Java\jdk1.8.0_60\include\win32;C:\Program Files\Java\jdk1.8.0_60\include;$(IncludePath)
Library Directories:
C:\Program Files\Java\jdk1.8.0_60\lib;C:\Program Files\Java\jdk1.8.0_60\jre\bin\server;C:\Program Files\Java\jdk1.8.0_60\jre\lib\amd64;$(LibraryPath)
Under Linker -> Input -> Additional Dependancies:
jvm.lib;%(AdditionalDependencies)
Configuration Dropdown : Active(Debug)
Platform Dropdown : Active(x64)
The program compiles and links without errors.
When I run the program whether in Visual Studio or from the Command prompt the error pops up:
I can find two copies of jvm.dll on my computer.
C:\Program Files\Java\jre1.8.0_60\bin\server\jvm.dll
C:\Program Files\Java\jdk1.8.0_60\jre\bin\server\jvm.dll
I tried adding those directories to the PATH with
set JVMDLLDIR="C:\Program Files\Java\jre1.8.0_60\bin\server";
set PATH=%LIBJVMDIR%;%PATH%
Simple.exe
It had no effect, the error was the same.
In linux I compile with the flag -Wl,--rpath /usr/lib/jvm/... so that linux can find the libjvm.so when my program runs. It would seem that a similiar option for Visual C++ is needed but I can not find one. Another alternative in linux would be to add the directory to the LD_LIBRARY_PATH environment variable, but again I have been unable to find a similiar option in windows.
from Newest questions tagged java - Stack Overflow http://ift.tt/1hZuy27
via IFTTT
Aucun commentaire:
Enregistrer un commentaire