I understand that you can set the Java library path with an option (-Djava.library.path=/path/to/libs
) before executing the program, but is there a place on the system where Java looks if you don't set it manually?
Its default value depends on the operating system: On Windows, it maps to PATH. On Linux, it maps to LD_LIBRARY_PATH. On OS X, it maps to DYLD_LIBRARY_PATH.
If you have single native libs in your project, there is another way you can do it. Go to Project properties->Java Build Path->Source. You'll find a list of source-folders. Each entry under the the Source tab has Native library locations.
Step 1: Right-click the project and select “Build Path » Add Libraries…”. Step 2: Dialog the window that pops up, select “User Library” and click the “Next” button. Step 3: Select the user libraries you want to add and click “Finish”.
Use java -XshowSettings:properties to show the java. library. path (and others) value. Thanks Jose, this helped me.
Its default value depends on the operating system:
PATH
LD_LIBRARY_PATH
DYLD_LIBRARY_PATH
However, Matt Ball is not totally correct.
On my Linux box, my Java library path is
/usr/lib64/icedtea6/jre/lib/amd64/server:/usr/lib64/icedtea6/jre/lib/amd6ib/amd64:/usr/lib64:/lib64:/lib:/usr/lib
While my LD_LIBRARY_PATH
is /usr/local/lib64
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With