LibraryNotFoundException while running java code that invokes dlls
I have written a code that requires 2 dll's at runtime.I have those dll files in C:\Program Files\Java\jdk1.6.0_01\jre\bin
.
I have set the environment variable PATH accordingly.
It compiled successfully and then while running it gives the following error:
Exception in thread "mai开发者_StackOverflow社区n" java.lang.ExceptionInInitializerError
at teamdev.jxcapture.Capture.captureActiveWindow(Unknown Source)
at ppb.activewindow.execute(activewindow.java:24)
at ppb.activewindow.main(activewindow.java:68)
Caused by: com.jniwrapper.LibraryNotFoundException: Cannot find JNIWrapper nativ
e library (jniwrap.dll) in java.library.path: C:\Program Files\Java\jdk1.6.0_01\
jre\bin\jniwrap.dll
Could anybody please help me to resolve this problem?
The value of java.library.path
should be the directory containing the DLLs, not the filename of the DLLs themselves. It looks like your java.library.path
is set to
C:\Program Files\Java\jdk1.6.0_01\jre\bin\jniwrap.dll
instead of
C:\Program Files\Java\jdk1.6.0_01\jre\bin
It looks like the DLL is not being found on the Java Library Path. See this - http://www.inonit.com/cygwin/jni/helloWorld/load.html
Try moving JDK to a path without spaces.
精彩评论