JNI and appletsJuly 10, 2005I have to call some native methods from inside and applet but all the pundits are saying you cannot use JNI with applets. That does not worry me at all. When we created the Rad SFTP Applet we heard the same thing. But that product went onto become featured on the java website. JNI is something that has been in the outer fringe of my knowledge base but I have never used it because like many I have always found more platform independent ways of doing it. Like Many I have also had trouble getting the darned thing to work first up. This post in java forums sums it up.
- Yes, I have searched this forum for "UnsatisfiedLinkError" and found 457(!!!) entries;
- Yes, I've read them all;
- Yes, I did use "javah" to create the header file;
- Yes, I create my HelloWorld class in the default package;
- Yes, I'm shure, the system loads my "Hello.dll".
In my case, I just did the naturall thing of placing the java file in a package but got the names mixed up. Still the only way I can get the shared object to load is by passing in the path with -Djava.library.path=/usr/lib/ or using the LD_LIBRARY_PATH. For the life of me I cannot see why it's refusing to load the library without this directive. But I am beginning to see why so many naysaysers are of the opinion that JNI and applets cannot be used together. JNI can also be used in a platform independent manner if you can create separate libraries for each OS that you application/applet is likely to be used on. Now that the need has arisem, during the next few days I will be dabbling in this technology (even though I have not got off to an auspicous start). So you can expect to hear more on this topic soon. Follow up:
|
|



