Exception in thread "main" java.lang.UnsatisfiedLinkError

My program:

publicclass Test{

publicstaticvoid main(String[] args)throws Exception

{

String libraryPath = System.getProperty("java.library.path");

System.out.println(libraryPath);

System.setProperty("java.library.path", libraryPath +";C:\\dlls\\ntvinv.dll");

System.loadLibrary("ntvinv");

}

}

Exception I get :

Exception in thread "main" java.lang.UnsatisfiedLinkError: C:\dlls\ntvinv.dll: A dynamic link library (DLL) initialization routine failed

at java.lang.ClassLoader$NativeLibrary.load(Native Method)

at java.lang.ClassLoader.loadLibrary0(Unknown Source)

at java.lang.ClassLoader.loadLibrary(Unknown Source)

at java.lang.Runtime.loadLibrary0(Unknown Source)

at java.lang.System.loadLibrary(Unknown Source)

at Test.main(Test.java:9)

the dll - ntvinv is in C:\dlls\

Can anyone please help solve the issue.

Thanks

[1353 byte] By [Latchua] at [2007-10-3 8:20:39]
# 1

The Java system property java.library.path cannot be changed after the JVM is started.

So the code you showed cannot work.

All you have to do in your code is:System.loadLibrary("ntvinv");

Then given that the ntvinv.dll native library is located under the C:\dlls folder,

you have to set the property when starting the JVM like this:java -Djava.library.path=C:\dlls Test

Regards

jfbrierea at 2007-7-15 3:26:20 > top of Java-index,Java HotSpot Virtual Machine,Specifications...
# 2
The other way, you can go isString AbsolutePath = "C:\\dlls\\";String libName = System.mapLibraryName("ntvinv");System.load(AbsolutePath+libName);You can start the JVM normal way.
Amit.Pola at 2007-7-15 3:26:20 > top of Java-index,Java HotSpot Virtual Machine,Specifications...