问题描述
我们有一个大型 Java 应用程序,可以作为小程序或 Java Web Start 运行.而且越来越长.典型的用户只需要一小部分类.因为Java不知道它在哪个jar文件中可以找到哪个类,它会加载所有jar文件,直到找到该类.如果它将加载一个不存在的类(例如资源包),则它会加载所有 jar 文件.这大大减少了小带宽上的启动时间.
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.
我认为它应该使用 URLClassLoader 进行下载.
I think it should use a URLClassLoader for downloading.
推荐答案
我听说您可以实现自定义类加载器,并且我看过有关此主题的教程.有了这个,您应该能够更精确地控制下载的内容.抱歉,我自己没试过.
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.
这篇关于Java Applet 是否有任何插件框架?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!