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, applets and ClassLoader re-use



Cool. But instead of making multiple copies, wouldn't it be more efficient to save the library as a randomly named temp file (as Glen suggested last week in another thread), load the library into memory, then delete the temp file? And repeat on the off-chance that you pick the same random name more than once...
-Curtis

At 05:27 PM 3/17/2004, Dmitry Markman wrote:
>ugly :-)
>but definitely will work
>thanks
>
>On Mar 17, 2004, at 6:02 PM, Jon Stocks wrote:
>
>>This may not be the optimal solution but one thing you can do is load a
>>duplicate of the jni lib depending on if you could load the previous
>>library. This will result in multiple jni libraries on the client's machine
>>but, it will get you around the problem.
>>
>>Essentially, what you could do is package the jni library in your jar file.
>>When the client requires the jni library, the applet (thanks to it being
>>signed) could copy the jni library to the client. Your first copy could be
>>something like:
>>
>>Library0.jnilib
>>
>>If the applet fails to load it, copy a duplicate library called
>>Library1.jnilib. Then try to load that library instead. Etc...
>>
>>There are all sorts of algorithms you could use here.
>>
>>Now, this may not be a very good solution for your setup. It depends on how
>>often your library gets loaded or how big your jni library is. But, it will
>>allow you to use JNI from an applet without running into this problem.
>>
>>Jon
_______________________________________________
java-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/java-dev
Do not post admin requests to the list. They will be ignored.


References: 
 >RE: JNI, applets and ClassLoader re-use (From: Jon Stocks <email@hidden>)
 >Re: JNI, applets and ClassLoader re-use (From: Dmitry Markman <email@hidden>)



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.