Solved

JNI from trusted applet

Posted on 1998-03-03
1
407 Views
Last Modified: 2008-02-26
How do I cause a trusted applet to load a native library?  When running as either of the following, the native libary is successfully loaded:

- An application, or
- Appletviewer with classpath set, the native library is loaded.  Running appletviewer with CLASSPATH set and the .jars in   that classpath causes the file loader to be used and applet restrictions don't exist

.  However, when I run appletviewer without classpath (causing applet class loader to be used), the native library cannot be loaded.  The dlls are in my Win NT PATH.

I configured appletviewer for trusted applets and get beyond the initial security restrictions, e.g., reading restricted system propertities, but fail when trying to load a library:

java.lang.UnsatisfiedLinkError: fixFloat
      at
[888940955234] 0 S 1 [Thread-5] class com.ibm.frn.DocViewThread obj.id:8065d5 in GETNEXTDOCUMENT
      at java.lang.ClassLoader.resolveClass(ClassLoader.java:245)
java.lang.UnsatisfiedLinkError: fixFloat
      at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:322)
      at
      at com.ibm.frn.EnvThread.run(EnvThread.java:87)
      at java.lang.ClassLoader.resolveClass(ClassLoader.java:245)
      at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:322)


The same problem (UnsatisfiedLinkError) occurs with Netscape Communicator with Java Activator.  The applet's jar file is signed, and Activator is configured for trusted applets.

What do trusted applets use to locate native libraries?  I don't think it's PATH (on Win NT) because my PATH is correct.
0
Comment
Question by:dsanders030398
1 Comment
 
LVL 6

Accepted Solution

by:
jpk041897 earned 100 total points
Comment Utility
As you tated you can use CLASSPTH.

Other option include placing the ative code on the same pat as the applet .class file or using the CODEBASE=path option inside the APPLET tag in your HTML file.

PATH will also work, but only if the PATH where the nativ code is stored is inside the web page servers directoy tree. The server willnot allow you to read/write files ouside of its web page directory structure for scurity reasons.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

For customizing the look of your lightweight component and making it look opaque like it was made of plastic.  This tip assumes your component to be of rectangular shape and completely opaque.   (CODE)
Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now