I’m making a program use JNI to call some native directives. My code is:System.loadLibrary("poc_NativeShellExecutor");
When I run the code, I got the exception:
Caused by: java.lang.UnsatisfiedLinkError: no poc_NativeShellExecutor in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1860)
at java.lang.Runtime.loadLibrary0(Runtime.java:845)
at java.lang.System.loadLibrary(System.java:1084)
I check the java.library.path and I’m sure I do put the poc_NativeShellExecutor.dll in C:\Windows\System32.
Here is some info of my system:
Java version: 1.7.0_03, vendor: Oracle Corporation
Java home: E:\Program Files (x86)\Java\jdk1.7.0_03\jre
Default locale: en_US, platform encoding: GBK
OS name: "windows 7", version: "6.1", arch: "x86", family: "windows"
Could u please give me some help?
This is not the solution, but additional data, that I hope can help to find one.
I have the same issue as the OP.
My system is
Windows7 Ultimate x64 SP1.I run my 32-bit
test_x86.dllusing the 32-bit jvm 1.6.0_29.I’ve tried to place
test_x86.dllin the following folders:and it works: my
test_x86.dllis successfully loaded.But if I place my dll into
I get the exception:
I change my
java.library.patheach time before trying to load the dll, so it always starts with the corresponding directory:I also tried to use the default
java.library.path(that containsC:\Windows\System32by default) withtest_x86.dllinC:\Windows\System32. No luck: it also leads to the exception above.I always have the single copy of
test_x86.dllin folders that are in thejava.library.path, i.e. only one of the folders contain that file at a time.Conclusion:
It seems that in Windows 7 x64 the
C:/Windows/System32have some tricky restrictions.Earlier on my Windows XP 32-bit machine, I never warried about
C:\Windows\System32folder andjava.library.pathchanges. I’ve simply used theSystem.loadLibrary("test_x86");call withtest_x86.dllin that folder, and it always worked.