Search code examples
javajava-native-interfacejava-web-start

How to restart the Java Process with -Djava.library.path?


I have an application that is started with JWS. The first time user launches this application he has to choose a path where Berkeley DB XML is installed. I do need this to set the native library path and restart the application with -Djava.library.path parameter. Berkeley DB XML java bindings uses JNI to make calls to the database. Since our users may have different OS I cannot rely on a default location.

So, I have a problem with getting current classpath. When I print out "java.class.path" it only gives me "/System/Library/Frameworks/JavaVM.framework/Resources/Deploy.bundle/Contents/Home/lib/deploy.jar". I have three jars that I cannot find in my sys props. on my Mac.

I hope this was understandable and thanks for any tips beforehand.


Solution

  • Try to repaire permissions with DiskUtil.

    Avoid using this pattern. What you could do is to store the command and execute that simulating that you are starting a new process.