How to set java.library.path as default?
I'm just wondering how exactly does Java decide on the default value for its property java.library.path
?
I am running * buntu 14.04 64 bit and it defaults (the first two do not exist):
/ Usr / java / packages / Library / amd64
/ USR / lib64
/ Lib64
/ Library
/ usr / lib
Searching through my environment variables, I found there was nothing in it. The installation LD_LIBRARY_PATH
adds its contents to this list.
Given this information, I am assuming this list is explicitly set (coded) in Java, but I cannot find any documentation on it. Is my guess correct? What are its defaults for different OS? Will these values change across the distribution?
I am asking for two reasons. 1) I'm just curious. 2) I want to know where I can put the library so Java always finds it.
source to share
If you want to find the path that is currently installed on your computer, follow these steps.
System.out.println(System.getProperty("java.library.path"));
you can specify the path explicitly in your code like this
System.setProperty("java.library.path", "/path/to/library");
via command line
java -Djava.library.path=<path>
Also I would not call it an environment variable. This is a system property used by jvm.
source to share