Applets and Native methods

2005 Aug 4 at 20:25 » Tagged as :

Finally created that article on mixing JNI and applets that I have been threatening to write. It's the first update to the site in months and I am sure many people will find the article usefull.

As I pointed out earlier, lots of pundits are of the view that you simple cannot mix native methods with applets. That is not so (as you will no doubt find). It's just a little bit complicated.

The complications revolve around how the native library is to be loaded. The simplest way is to just ask the user to download the library and place it on his home folder. But that sounds clumsy so the better approach is to simply open a URL connection, read it's InputStream and get an OutputStream for saving the same library to the hard disk.

This approach of course means that the jarfile has to be signed. If you are using native code the jar should be signed anyway so you need not give it a second thought.