开发者

Java Applet and dll

I'm writing a web application that allows users to upload documents importing them directly from devices (i.e. scanners).

I would like to realize a simple web app that uses a Java Applet to handle dev开发者_如何学Goice communication. I have created the jtwain.dll following this tutorial : http://today.java.net/pub/a/today/2004/11/18/twain.html and a demo app works fine in standalone mode.

Now I need to switch to applet but I don't know how to distribute the jtwain.dll to the client in order to make the applet work fine (this app will be used in an intranet where the clients are Windows XP or later).


I did this a long time ago, but the gist of it is that you want to extract the DLL out of your applet's code base so you'll store it in the JAR, and then you want to copy it into the /lib/ext folder of the JRE.

 //Where this is an applet
 URL codeBase= this.getCodeBase();
 URL twainUrl new URL(codeBase, "jtwain.dll");
 String javaHome=System.getProperty("java.home");
 //copy the contents of twainUrl to javaHome\lib\ext

You'll need your applet to be signed.


Since 1.6.0_10, applets can be (embedded &) launched using Java Web Start. JWS not only makes it easier to deploy natives, but can also partition the download by OS (.so for *nix, .dll for Windows etc.).

Of course, the same could be done from an application launched using JWS. A free floating frame (or applet) is always easier to get working and deployed than an embedded applet.


maybe you can include your dll into JAR file and load it dynamically

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜