Purpose of java.library.path
Perhaps this is a duplicate question, but I havn't found something by myself.
Basically I have an understanding problem.
I have an application which works fine when I call it as follows:
java -Duser.dir="some path" -Djava.library.path="pathToDLL1;pathToDLL2;pathToMyDir" classToCall par1
With the call above my application will start and run.
My problem in understanding is within the pathToMyDir开发者_如何学Python directory (the content of this directory is mainly some needed dll's).
When I start the same application with following command it will fail.
java -Duser.dir="some path" -Djava.library.path="pathToMyDir;pathToDLL1;pathToDLL2" classToCall par1
I'm not sure if this is because of some dependencies, but I thought the java.library.path is mainly used to tell java where to look for external libraries. Or is this wrong? Is there also some order information hidden?
-Djava.library.path
is used for pointing to native system libraries (dll or so files). It points to a directory and calls to native code that use System.loadLibrary
look in that directory for the native libs.
The project dependencies (jar files) should be specified on the application's classpath, not in this location.
精彩评论