How do I have to tell Java where to find native libraries?
I am trying to figure out if my Java is misbehaving or not.
I have cleaned and built my Java project in NetBeans and then tried to run the program on the command line with the following command:
java -jar ProjectName.jar
I get the following error:
The library x.dll could not be loaded by Windows. Make sure that the library is in your Path environment variable. Exception in thread "main" java.lang.ExceptionInInitializerError.
Does this mean that for every project with library files in the dist folder, I need to include it in the path environment variable? This sounds awfully trou开发者_运维问答blesome and I would have thought that Java would be smart enough to look inside the lib folder for these library files. Or do I need to configure something else in the IDE to do this?
java -Djava.library.path=<path where dll located> -jar ProjectName.jar
You need to include the dll or jar in the classpath when you launch the application / Java.
http://download.oracle.com/javase/7/docs/technotes/tools/windows/java.html
精彩评论