From: Miguel <mt...@mt...> - 2003-10-10 22:17:27
|
In a couple of recent emails and irc discussions I said that I was going to look into splitting the JmolApplet into several .jar files. My thinking was to put core display of simple file types into one .jar file. Put scripting and fancy visualization things into a second. And put fancy file types into a third. Web page developers would put all three in their <applet ...> tags <applet name="jmol" code="JmolApplet" archive="JmolApplet1.jar,JmolApplet2.jar,JmolApplet3.jar" ...> I have just completed some initial tests, and here are the top-line results: - different browsers behave differently * NS4 seems to always pull down all the .jar files * IE pulls them down on demand ... but it makes a *lot* of demands ... any file that refers to any instance of a class ends up pulling down that class ... so you quickly pull down everything * the Java Plug-in only pulls down the first .jar file. If it But the first time it fails to find a class it pulls down *all* the other .jar files ... so there is no advantage to going beyond two .jar files. In addition, while it is downloading the .jar files, it *also* tries to download the missing class files, thereby creating more network traffic. - it would make the build process significantly more complicated - it could become an administrative hassle Therefore, I am not going to do it. At least, I am not going to do it in the way that I was thinking about it. A .jar file allows you to define a 'classpath' in the manifest. On the newer Sun Java Plug-in the class loader apparently *will* respect this. That is, one's core .jar file can list additional .jar files ... and it seems to work. But only for the Sun Java Plug-in. I then did some investigation into having the code dynamically modifying the classpath in the context of the applet. The idea was to have the core JmolApplet.jar file add the additional .jar files to the classpath on the fly. It looks like that is possible on the newer Sun JVMs ... but it won't work for older browsers. Another dead end. I am going to keep chewing on this problem. I still need to do a little more research on dynamic loading of classes. But the outlook looks pretty bleak. I suspect that we will be stuck with one large .jar applet. Oh well ... Miguel |