Can I place *.SO files in a *.jar file?

Hello.

I'm a bit new at this, and this is my question:

I have a library called lib which contains 2 *.so files and another sub directory that contains a lot of *.java files

I don't really know how or why but there is some dependence of the *.so files and the *.java files , so in order to use functions from the *.so i need to use this line:

javac -classpath ../lib Dot.java

I want to transform this library into a jar file so I could easily move it to other people , and to include it when i use Eclipse

However , no matter how I try to jar the directory into lib.jar file, and use the command:

javac -classpath ../lib.jar Dot.java

I keep getting errors that it could not find the needed classes...

What to do?

Message was edited by:

Yossale

[823 byte] By [Yossalea] at [2007-10-3 2:23:49]
# 1

> I don't really know how or why but there is some

> dependence of the *.so files and the *.java files ,

It's called JNI.

> so in order to use functions from the *.so i need to

> use this line:

> javac -classpath ../lib Dot.java

Uh... the *.so files have to be somewhere where the system finds them. Anyway, they don't matter during compilation, so you don't have to do what you're doing because of the native libs.

> I want to transform this library into a jar file so I

> could easily move it to other people , and to include

> it when i use Eclipse

Do it.

> However , no matter how I try to jar the directory

> into lib.jar file, and use the command:

> javac -classpath ../lib.jar Dot.java

javac is the compiler. Do you mean "java"?

> I keep getting errors that it could not find the

> needed classes...

Set the classpath to your JAR. This has nothing to do with native libs.

And to answer the question you didn't ask in your post: no, you can't load *.so files from JARs. What you could do is to let your program unpack the libs and write them into the file system, to a place in the PATH where they would be found.

CeciNEstPasUnProgrammeura at 2007-7-14 19:22:49 > top of Java-index,Java Essentials,New To Java...
# 2
Thank you very much for your reply - i was really lost.
Yossalea at 2007-7-14 19:22:49 > top of Java-index,Java Essentials,New To Java...