Loading the same native Libaries in different Applets doesnt work !

Advertisement
The problem is the following :
I have applet_1 that does System.loadLibary("mydll")
and i have applet_2 that does System.loadLibary("mydll")
both calls are static but it doesnt matter.
When i call applet_1 first in my browser it can do anything it wants (function calling in dll etc).
When i call applet_2 after that in my browser, it doesnt load the libary, nothing happends - no exception thrown it just doesnt happend anything. The applet works fine but cant do any method calling to the dll.
The same happends if i open applet_2 first and after that applet_1 suffer the same problems that it cant call any dll methods, unless i close the browser.
So, the first applet that loads the libary is the only one who is able to call methods within the dll.
Further observation is, i made a simple class that only loads the libary, i set an int to 1 when the libary is loaded, however when the other applet calls that class the int is NOT 1 anymore, it has its initally value which leads me to believe that every applet in the java plugin has its own virtual machine.
I found this thread, it has the very same problem. However i didnt find anything about the bug 4299094.
http://forum.java.sun.com/thread.jsp?forum=30&thread=33843
Any ideas what i could do to solve this problem ? When i copy the dll and rename it to mydll2 i can use mydll in applet_1 and mydll2 in applet_2.
Regards
Advertisement

Replay

Further notice :
I put both applet classes into one jar after i read about the Class Loader Issues in the documentation of the java plugin.
"Class Loader Issues
Prior to version 1.3.1_01a, Java Plug-in would use a single class loader to load multiple applets during a browser session. This practice allowed the multiple applets to share information with each other through static variables.
In order to maximize compatibility with the Java virtual machines embedded in Microsoft Internet Explorer browsers, beginning with version 1.3.1_01a Java Plug-in uses separate class loaders for applets that differ in their codebase and/or the value of the ARCHIVE parameter in the APPLET tags that invoke the applets. Only if two or more applets share the same codebase and have the same value for their ARCHIVE parameter will the same class loader be used.
Applets that rely explicitly on the old Java Plug-in behavior with respect to class loaders may be incompatible with the new Java Plug-in. That is, applets that rely on the ability to share information afforded by a single class loader may fail to work properly if the new Java Plug-in uses separate class loaders for each applet. If this compatibility issue applies to your applets, you can force Java Plug-in to use a single class loader for multiple applets by simply ensuring that all applets have the same codebase and that the APPLET tags used to launch the applets each has the same value for the ARCHIVE parameter. "
Both applets now can load the libary but ONLY if executed in the SAME window, if i open a new window and load applet_1 or applet_2 the libary cant be loaded in the NEW window. It will still work flawless in the old window for applet_1 and applet_2 but in the new window applet_1 and applet_2 dont work.