Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: JNI Lib Location when Loading from Java Applet on OS 10.2



Noa Yissar <email@hidden> wrote:

>Here's what I tried:
>the library is named libxxx.jnilib, as required. If I
>locate the library in /Library/Java/Extensions folder
>and run a Java application such as the JNISample, the
>lib is found and it works fine. However, in my case
>the library is loaded from an applet that's activated
>from an IE web page. More specifically, an html page
>with Java script loads an applet that is wrapped in a
>signed jar file from our server. This applet calls
>"System.loadLibrary(xxx)".

At a minimum, I think both the JNI-lib file and the Java code loading it
and linking to its native methods must be in the same extensions directory.
It's for security reasons.

This assumes that MSIE is even looking in the Java extensions directories.
You didn't mention an MSIE version, and what it does may be
version-dependent. You should be able to calibrate your expectations by
examining the values of two system properties: "java.library.path" and
"java.ext.dirs". The first is a series of locations from which only native
libs are loaded. The second is a series of locations from which jars or
native libs are loaded. Some systematic experiments with a jar-file and
jni-file may also be useful.

If nothing else works in MSIE, you can always fall back to using
System.load() and give an absolute pathname starting with
"/Library/Java/Extensions/" (but permissions may be problematic). Or you
can build up a pathname from the "user.home" property and
"Library/Java/Extensions". I'd only do that if an exception is thrown by
loadLibrary(). Also, this approach may require permissions in the security
policies file. You should be able to tell by whether it throws a
SecurityException or an UnsatisfiedLinkError.

-- GG
_______________________________________________
java-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/java-dev
Be sure to read the FAQ http://developer.apple.com/java/faq/ before posting
Do not post admin requests to the list. They will be ignored.



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.