This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Applets and the fly likes Accessing native code from signed applet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Applets
Bookmark "Accessing native code from signed applet" Watch "Accessing native code from signed applet" New topic
Author

Accessing native code from signed applet

J. Astin
Greenhorn

Joined: Sep 22, 2004
Posts: 1
I am having a hard time getting my applet to access native code. I have an applet in a signed jar that downloads a native dll, then calls System.load() to load the library, then calls a method in that native library. I am doing all of this using AccessController.doPrivileged(). In the web page, I get the prompt about trusting the applet. I am able to download the dll and load the library successfully (can't delete the dll while the browser is open, so it must be loaded), but when I call into the native method, I get an UnsatisfiedLinkError on the method name. I have tested the dll to ensure that the method name is correct by running the code as a local application, and it all works fine. Any ideas on what I'm missing?

JRE 1.4.2
IE 6
Win XP

Any help would be great.

Thanks
Ben Groeneveld
Greenhorn

Joined: Oct 15, 2004
Posts: 1
I am doing this also from an applet which downloads, installs, and loads a dll. My problem was that the applet was part of a package. I did what you did, i.e., test as standalone class, then as standalone applet, and then as applet to resolve. The key was to invoke javah with the package name prepended to the class to generate the right sig. I can send you my source if this is of help. Makefile snippet:

AppcastObject.h: AppcastObject.class
javah $(JAVACFLAGS) -o AppcastObject.h communicast.nappcast.AppcastObject

testharness: all
cp ../../../../AppcastObject.dll ../../../../WrapperAppcastObject.dll .
regsvr32 ./AppcastObject.dll
java $(JAVACFLAGS) communicast.nappcast.AppcastObject
regsvr32 /u ./AppcastObject.dll
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Accessing native code from signed applet
 
Similar Threads
SQL JDBC Tomcat "Native Library sqljdbc_auth.dll already loaded in another classloader"
java.io.FileNotFoundException: (Access is denied)
JNI: The specified procedure could not be found.
Singed applet issue.
JNI and J2EE