• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2022
  • Last Modified:

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!
0
pbenito
Asked:
pbenito
  • 4
  • 3
  • 2
1 Solution
 
cmalakarCommented:
>> 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
0
 
pbenitoAuthor Commented:
How do I do this in NetBeans?
0
 
cmalakarCommented:
instead.. you can also do this..

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

System.setProperty("java.library.path", "PathToYourLibrary");
0
Cloud Class® Course: CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

 
pbenitoAuthor Commented:
I used the System.setProperty method and I get the same error.
0
 
mbodewesCommented:
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.
0
 
pbenitoAuthor Commented:
I tried both options and I keep getting the same error.....any other ideas?
0
 
mbodewesCommented:
In netbeans, you should be able to pass the -Djava.library.path to the JVM. The property should be set to the path *excluding* the name of the file itself. The file itself should be called <libraryname>.dll (assuming windows) or <libraryname>.so in Linux. I presume you have found the .dll, can you explain what exact options you have tried?

Optionally, the library could also be loaded using the full path to the library from the .jar. In this case you will have to see the documentation of whoever supplied the jar library to you.
0
 
pbenitoAuthor Commented:
That worked!!!  Why did I have to reference a .dll file?  I thought that Java doesn't use DLLs?
0
 
mbodewesCommented:
"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.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 4
  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now