java.library.path property overrides LD_LIBRARY_PATH on ubuntu

System class has a method loadLibrary(libname) to load native library. If java.library.path property is set, this method seaches for libname in the path names specified by java.library.path property. If java.library.path property is not set, it searches for libname in the path names specified by LD_LIBRARY_PATH. java.library.path take precedence over  LD_LIBRARY_PATH. In other words, if java.library.path is specified, LD_LIBRARY_PATH is ignored. I have verified it with JDK 1.6 on Ubuntu.

 

This behaviour is not documented in JDK documentation. And I can't find an answer by googling. So I write down it here for people to reference.

 

 

你可能感兴趣的:(java,jdk,ubuntu)