PPB
PPB

Reputation: 85

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 "main" 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?

Upvotes: 3

Views: 6179

Answers (2)

Thomas
Thomas

Reputation: 181745

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

Upvotes: 2

Padmarag
Padmarag

Reputation: 7214

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.

Upvotes: 0

Related Questions