Link to home
Start Free TrialLog in
Avatar of pbenito
pbenito

asked on

What does this error mean: Exception in thread "AWT-EventQueue-0" java.lang.UnsatisfiedLinkError: no nitf.jni-c in java.library.path ?

Hi,
 
   I'm writing a Java program and when I call a method that is included in a jar library, I get the following error:

Exception in thread "AWT-EventQueue-0" java.lang.UnsatisfiedLinkError: no nitf.jni-c in java.library.path


  Any idea on what this error means?

Thanks!
Avatar of cmalakar
cmalakar
Flag of India image

>> java.lang.UnsatisfiedLinkError: no nitf.jni-c in java.library.path

Means a library file is missing the java library path.. If you know.. the library..
then add the library to the java.library.path as follows.. when you start the java program.

java -Djava.library.path=PathToYourLibrary ProgramName
Avatar of pbenito
pbenito

ASKER

How do I do this in NetBeans?
instead.. you can also do this..

In the first line of main function.. write..

System.setProperty("java.library.path", "PathToYourLibrary");
Avatar of pbenito

ASKER

I used the System.setProperty method and I get the same error.
cmalaker, the setProperty method does not work. The default classloader won't notice changes in the java.library.path property. The -D option does work obviously. You could also put the library in the default windows path. Either add a folder to the windows path to store the library, or in extreme cases put the .dll in the windows folder or the bin folder of your Java runtime.
Avatar of pbenito

ASKER

I tried both options and I keep getting the same error.....any other ideas?
ASKER CERTIFIED SOLUTION
Avatar of mbodewes
mbodewes
Flag of Netherlands image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of pbenito

ASKER

That worked!!!  Why did I have to reference a .dll file?  I thought that Java doesn't use DLLs?
"That worked!!!  Why did I have to reference a .dll file?  I thought that Java doesn't use DLLs?"

Java may use libraries to do native (as in "native to the operating system"). Without an interface to the operating system, there is very little Java can do. It would not be able to read files, create network sockets, create windows etc. etc. . Of course, the base JVM will make sure that the most common options like the ones I've mentioned are present for all platforms. For new platforms, this functionality will have to be provided.

That still leaves an awful lot of functionality that is not directly available within the Java runtime. Much of it you will never need, or can be recreated in the Java language itself. But if you want to access OS functionality (i.e. drivers) or CPU functionality (i.e. SSE "multimedia" instructions) directly, you will still need native code. This native code can be supplied in JNI compatible .dll's. This is what you are currently configuring.