File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Accessing native code from signed applet

 
J. Astin
Greenhorn
Posts: 1
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic