Monday, June 11, 2012

How do you set Java library path programatically?

Java library path
can be set by choosing an option as:--Djava.library.path=your_pathWhile setting the java.library.path property to "." instructs the Java virtualmachine to search for native libraries in the current directory.And you execute your code as :

java -Djava.library.path=. HelloWorld

The "-D" command-line option sets a Java platform system property. But thesevalues are 'read only'
like many of the system properties, the value in java.library.pathis just FYI and changing it doesn't actually change the behaviour of the JVM.If you want to load a library from a specific location, you can use System.load() insteadwith the full path to the library

No comments:

Post a Comment