Is there any plugin framework for Java Applets?

删除回忆录丶 提交于 2020-01-01 10:52:10

问题


We have a large Java application that run as applet or Java Web Start. And it grow more and more. Typical a user need only a small part of the classes. Because Java does not know which class can it found in which jar file that it load all jar files until it find the class. If it will load a class that not exist (for example a resource bundle) then it load all jar files. This reduce the start time on a small bandwidth very large.

Is there a small framework with which we can load the plugins only if needed? Or better if needed and on background?

Of course the framework should not delay the start time self with it large size.

I think it should use a URLClassLoader for downloading.


回答1:


I've heard that you can implement custom class loaders and I've seen tutorials on this subject. With this you should be able to control what gets downloaded more precisely. Sorry, I haven't tried this myself.




回答2:


This is not a direct answer to your question, but you might be able to mitigate the slow downloads by using Pack200 to significantly reduce the size of your JAR files. I've previously written about how effective this can be.

Other than that, I'd agree asalamon74's suggestion to use lazy downloading of JAR files.

Perhaps you can optimise the order of the JARs so that those that contain classes that will be loaded first appear earlier?




回答3:


I think (without jnlp I'm not sure) you already use the download property:

<jar href="sound.jar" download="lazy"/>

Since webstart has no information about the jar contents I assume it loads all of them if the class is missing.

Although I've never tried, but there is a <package> tag where you can give some hints to the webstart where to search for classes. Checks this (very short) documentation.



来源:https://stackoverflow.com/questions/383510/is-there-any-plugin-framework-for-java-applets

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!