Jared Plumb wrote:
>I am writing a C++ application that launches java class files and ran into a
>little problem. I need to add the option -Djava.library.path=<path> but
>when I do, it stops using java extension in the system folder.
I don't know what you mean by "java extension in the system folder". I
know of no conflict between an empty or non-default "java.library.path" and
any properly installed Java extensions.
If a Java extension (i.e. a jar in an extension dir) refers to a JNI-lib,
and that JNI-lib is in the same dir as the jar itself, then the JNI-lib
will be found and loaded correctly. I've tried this and it works on 1.4*
and 1.3*. If you're seeing a failure, please describe exactly which class
or extension is failing, and where it's located.
The default value of "java.library.path" has this list of dirs:
.
/Users/{USER}/Library/Java/Extensions
/Library/Java/Extensions
/System/Library/Java/Extensions
/usr/lib/java
The middle 3 are also in the default list for "java.ext.dirs".
So if you simply set "java.library.path" to be this list:
.
/usr/lib/java
/your/dir/here
then everything should still work, assuming that any extensions with
JNI-libs are correctly installed (JNI-lib adjacent to jar).
If you can't assume that the extensions are correctly installed, then you
should use the 5-element default list above, and then append your dir.
Either way, I don't think you have to get the default value and append to it.
>but I can't figure out how to get that property in C++.
>The java call is java.lang.System.getProperty.
The JNI Specification and Guide has plenty of examples that show how to get
a class, get a static method descriptor, then invoke that method. It all
seems pretty straightforward to me, so please explain exactly what you
can't figure out about it.
<http://java.sun.com/docs/books/jni/>
-- GG
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/java-dev/email@hidden
This email sent to email@hidden