Jump to content
Excelsior Forums
DMA02

Program throws unsatisfied link exceptions [solved]

Recommended Posts

Hi, first off I wanna say how great ExcelsiorJET Pack II is. Made installation very easy and fast.

My problems is that I have a java program that loads a native library (rxtx serial on linux) using System.load. I do send the system library path as an argument when starting the VM.

Now, excelsior Jet detected this and set everything up for me when I compiled the program to native. I did a test run, works perfectly.

I run JetPack II... I put all the settings, I include what i need to include. I do a trail run and it works! Good right? well then I continue with the packaging. I create an installer.

OK, so as an added test I install the program using the installer on my workstation. Works.

Now, when I run the installer on another machine (jet is not installed on this machine), everything works except it tells me it can't find the rxtxSerial library in the java.library.path.

What I can't figure out is why does the same installation work on my workstation but not on another PC? And by "work" I mean it finds and loads the rxtxSerial library. I know if finds it in both cases because if I remove the rxtxSerial.so file I get an error saying it can't find it. But when I have it it says that it's not in the java.library.path.

Do I need to send the library path as an argument to the native executable?? And if so how come it works on my workstation and not anywhere else :(

please help.

Share this post


Link to post
Share on other sites

I had this hunch that though it was compiled to native.. I still needed to somehow pass that -Djava.library.path argument to the Java run time.

I then realized there was a run script that Jet builds for me where it adds a JETVMPROP env variable and exports it. This variable has the -Djava.library.path in it along with other things. Sadly it was commented out, so I uncommented it and run it. My program now runs on the target machine.

Why this only happens on the target machine and not on the developer machine... I couldn't be bothered to figure that one out.

I thought Jet adds these JVM arguments into the executable?

Share this post


Link to post
Share on other sites

Using JETVMPROP on target machines is not the best way.

Please look at this KB  article (section "Creating an installation package")

Though the article is about Java3D, this particular section explains how to package native libraries.

Share this post


Link to post
Share on other sites

Thanks for that article. I read it and I see that it wasn't something so obviously easy from the start.

I have a question regarding this. How come during the trail run everything ran ok? And aside from that when I deployed the program on my workstation it still worked fine.

You think the JETVMPROP was already set during the packaging phase?

Share this post


Link to post
Share on other sites
How come during the trail run everything ran ok? And aside from that when I deployed the program on my workstation it still worked fine.

On Linux, the lookup of Java native libraries also uses $LD_LIBRARY_PATH. Seemingly, the env. var setting on your computer includes the respective directories.

Share this post


Link to post
Share on other sites
the lookup of Java native libraries also uses $LD_LIBRARY_PATH. Seemingly, the env. var setting on your computer includes the respective directories.

I don't know. I just tried running the program right now on my workstation and my $LD_LIBRARY_PATH is blank and it found the library files.

Also these native libs of rxtx are not in a system wide location so they're not in any of the other env vars that you would normally find on the system (ie., like the ones containing java bins)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×