jhadley
jhadley

Reputation: 422

Conflict when using both java.endorsed.dirs and java.library.path

I have an existing java application that utilizes CORBA. As a result, it uses the java.endorsed.dirs command line parameter to point to the directory that contains the CORBA libraries we are using. The application is currently running just fine with the following command line:

java -splash:images/logo.png -Xms64m -Xmx1024m -Djava.endorsed.dirs=./lib -jar "myapp.jar"

Now, I need to add WorldWind support to my application. The WorldWind jar files call native libraries and seem to direct me to using the java.library.path command line parameter to point to the directory that contains the native libraries. When I use the following command line (add the java.library.path):

java -splash:images/logo.png -Xms64m -Xmx1024m -Djava.endorsed.dirs=./lib -Djava.library.path="./lib" -jar "myapp.jar"

I receive the following error when I run my application:

..Exception in thread "main" java.lang.UnsatisfiedLinkError: no gluegen-rt in java.library.path    

"gluegen-rt" is one of the libraries that WorldWind uses. The exception above is saying that it is having a hard time finding WorldWind libraries

If I remove the java.endorsed.dirs directory from the command line

java -splash:images/logo.png -Xms64m -Xmx1024m -Djava.library.path="./lib" -jar "myapp.jar"

... then my application runs fine(except that it is now using the default CORBA implementation and not the one that ships with our product).

The only link I could find on this topic is here, but that question did not seem to get answered, so I thought I would ask here.

Can these two command line parameters co-exist? If not, is there a work around?

Note: I am running this on Red Hat Linux. Based on a comment I received, I did try setting LD_LIBRARY_PATH before running my app. That did not make any difference.

export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:./lib

Note: It is not possible based on end user setup to put our CORBA files in the standard jre /endorsed directory.

Note: I don't think this question is specific to CORBA or WorldWind, but I wanted to give the reasons that I am using both of the aforementioned command line parameters.

Upvotes: 2

Views: 2541

Answers (1)

jhadley
jhadley

Reputation: 422

I have a work around for my particular situation. Both command line parameters (java.endorsed.dirs and java.library.path) were pointing to the same directory. Things began to work when I changed them to point to different directories. I ended up moving the WorldWind libraries to lib/worldwind so that my command line looked like this:

java -splash:images/logo.png -Xms64m -Xmx1024m -Djava.endorsed.dirs=./lib -Djava.library.path="./lib/worldwind" -jar "myapp.jar"

I hope this helps someone else with this problem. Although I am still not sure why there was a "conflict" in the first place.

Upvotes: 1

Related Questions