loading native libraries with java webstart

W

weiss.matt

Hi All,

I'm hoping someone in the Mac/Java community can give me a bit of help
with a native library problem I'm having. I've been doing Mac
development for about 2 years now and I've faced the "unsatisfied link
error" problem and I've learned how to overcome it. At first, I
changed my DYLD_LIBRARY_PATH to include my dylibs. This worked, but
was a little clumsy. I then discovered that install_name_tool could
change my library dependency paths to point explicitely to my dependent
dylibs, or relatively with the @executable_path decorator.

All was well, then came Java Webstart :(
From what little I've learned, I need to put all of my native libraries

in a jar, and sign it of course, then include this jar in my classpath.
In any case I still get a "unsatisfied link error" I have 2
libraries, one is the jnilib and one is a dylib if I do an otool -L on
the jnilib it looks like this:

libXDSIII.jnilib (compatibility version 1.0.0, current version1.0.0)
libXDSIII.dylib (compatibility version 1.0.0, current version1.0.0)
/System/Library/Frameworks/JavaVM.framework/Versions/A/JavaVM
(compatibility version 1.0.0, current version 82.0.0)
/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation
(compatibility version 150.0.0, current version 368.26.0)
/usr/lib/libstdc++.6.dylib (compatibility version 7.0.0,current version
7.4.0)
/usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version
1.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current
version 88.1.3)

if I do an otool -L on the dylib, it looks like this:

libXDSIII.dylib (compatibility version 1.0.0, current version1.0.0)
/System/Library/Frameworks/IOKit.framework/Versions/A/IOKit
(compatibility version 1.0.0, current version 275.0.0)
/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation
(compatibility version 150.0.0, current version 368.26.0)
/System/Library/Frameworks/JavaVM.framework/Versions/A/JavaVM
(compatibility version 1.0.0, current version 82.0.0)

/System/Library/Frameworks/CoreServices.framework/Versions/A/CoreServices
(compatibility version 1.0.0, current version 18.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0,current version
88.1.3)
/usr/lib/libstdc++.6.dylib (compatibility version 7.0.0,
current version 7.4.0)
/usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version
1.0.0)

These were compiled with the -dynamic linker flag, thus including a
reference to themselves. In any case, I believe the jnilib is unable
to load the dylib because of the console output. Can anyone help me?
What should the java.library.path be set to on the jnilib and the
dylib?
Should it just be relative? does the jar that loads the jnilib need to
be at the same package level? Mine wasn't then I changed it, but it
still didn't help.

I do have the static code block that does a LoadLibrary on the XDSIII
library. And I have successfully used the same java code in a
non-webstart application before. I believe the only variable that I
need to adjust is the library paths, but that's just a hunch.

Please advise.

Thanks in advance,
Matt
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,981
Messages
2,570,187
Members
46,730
Latest member
AudryNolan

Latest Threads

Top