javaeclipseconfigurationbuildpath

How to set the java.library.path from Eclipse


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/ .so/ .jnilib. But the Application always exits with an error message that those files are not found on the library path.

I would like to configure this whole project to use the library path. I tried to add the path as a VM argument to some run configurations in eclipse but that didn't work.


Solution

  • 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.

    Native library location