Java applet and dll

I am writing a web application that allows users to download documents by importing them directly from devices (such as scanners).

I would like to implement a simple web application that uses a Java applet to handle communication with the device. I created jtwain.dll after this tutorial: http://today.java.net/pub/a/today/2004/11/18/twain.html and the demo application works great offline.

Now I need to switch to the applet, but I don’t know how to distribute jtwain.dll for the client so that the applet works fine (this application will be used on the intranet where the clients are Windows XP or later).

+4
source share
3 answers

I did this a long time ago, but the bottom line is that you want to extract the DLL from your applet code base in order to save it in the JAR, and then you want to copy it to the / lib / ext JRE folder.

//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 need your applet to be signed.

+4
source

Starting from 1.6.0_10, applets can be (deployed and launched) using Java Web Start . JWS not only simplifies the deployment of natives, but can also split the load by OS ( .so for * nix, .dll for Windows, etc.).

Of course, the same could be done from an application running using JWS. A free floating frame (or applet) is always easier to work and deploy than a built-in applet.

+2
source

perhaps you can include your dll in a jar file and load it dynamically

0
source

All Articles