JAR, JNI and libraries

M

Marcelo

How Can i include a library inside a JAr file ?
I have a jar file like this:
META-INF/
META-INF/MANIFEST.MF
Prompt.class
libPrompt.so

and the System.loadLibrary("Prompt");

but I get the error:
Exception in thread "main" java.lang.UnsatisfiedLinkError: no Prompt in
java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1682)
at java.lang.Runtime.loadLibrary0(Runtime.java:822)
at java.lang.System.loadLibrary(System.java:992)
at Prompt.<clinit>(Prompt.java:14)


help please

Marcelo
 
G

Gordon Beaton

How Can i include a library inside a JAr file ?
I have a jar file like this:

META-INF/
META-INF/MANIFEST.MF
Prompt.class
libPrompt.so

and the System.loadLibrary("Prompt");

AFAIK your only option (someone please correct me otherwise) is to
copy the file from the jar to the local file system before attempting
to load it.

/gordon
 
R

Roedy Green

META-INF/
META-INF/MANIFEST.MF
Prompt.class
libPrompt.so

and the System.loadLibrary("Prompt");

I have done it with JAWS, but I don't know if it is legal otherwise.
With JAWS it is quite slick. You can put in BOTH a DLL for windows and
a libxxx.so for Linux and JAWS will load the correct one for the
platform. You tell JAWS what you have in a resource statement in your
JNLP file.

I would put Prompt in a package. libPrompt.so would NOT go in one.
 

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,766
Messages
2,569,569
Members
45,044
Latest member
RonaldNen

Latest Threads

Top