How can I set the java.library.path
for a whole Eclipse Project? I\'m using a Java library that relies on OS specific files and need to find a .dll/
Remember to include the native library folder in PATH.
the easiest way would to use the eclipse IDE itself. Go to the menu and set build path. Make it point to the JAVA JDK and JRE file path in your directory. afterwards you can check the build path where compiled files are going to be set. in the bin folder by default though. The best thing would be to allow eclipse to handle itself the build path and only to edit it similar to the solution that is given above
Don't mess with the library path! Eclipse builds it itself!
Instead, go into the library settings for your projects and, for each jar/etc that requires a native library, expand it in the Libraries tab. In the tree view there, each library has items for source/javadoc and native library locations.
Specifically: select Project
, right click -> Properties / Java Build Path / Libraries tab, select a .jar, expand it, select Native library location, click Edit, folder chooser dialog will appear)
Messing with the library path on the command line should be your last ditch effort, because you might break something that is already properly set by eclipse.
I think there is another reason for wanting to set java.library.path
. Subversion comes with many libraries and Eclipse won't see these unless java.library.path
can be appended. For example I'm on OS-X, so the libraries are under \opt\subversion\lib
. There are a lot of them and I'd like to keep them where they are (not copy them into a standard lib directory).
Project settings won't fix this.
Another solution would be to open the 'run configuration' and then in the 'Environment' tab, set the couple {Path,Value}.
For instance to add a 'lib' directory located at the root of the project,
Path <- ${workspace_loc:name_of_the_project}\lib
You can add vm argument in your Eclipse.
Example :
-Djava.ext.dirs=cots_lib
where cots_lib
is your external folder library.