Where are the values of java.library.path being set?

Posted by lmestre on Oracle Blogs See other posts from Oracle Blogs or by lmestre
Published on Fri, 6 Jun 2014 03:39:02 +0000 Indexed on 2014/06/06 9:32 UTC
Read the original article Hit count: 194

Filed under:

This one could be a WebLogic Server question, but this post is general for any java environment.

We were getting  at the very beginning  java library path something like this:

/home/lmestre/jdk1.6/jre/lib/amd64/server:/home/lmestre/jdk1.6/jre/lib/amd64:/home/lmestre/jdk1.6/jre/../lib/amd64

So, the question was:


Where WebLogic Server is setting java.library.path?

I never found the answer, so why don't we try to try to answer

Where the JVM is setting java.library.path?

public class LibraryPathPrinter {

   public static void main(String[] args) {
       String javaLibraryPath= System.getProperty("java.library.path");
       System.out.println("java.library.path "+javaLibraryPath );
   }

}

after a simple

javac LibraryPathPrinter.java

and then an easy

java LibraryPathPrinter

voila!

The program printed something like this

java.library.path  /home/lmestre/jdk1.6/jre/lib/amd64/server:/home/lmestre/jdk1.6/jre/lib/amd64:/home/lmestre/jdk1.6/jre/../lib/amd64

So the JVM was the culprit.
Enjoy!

© Oracle Blogs or respective owner

Related posts about /Oracle