是否可以让 Applet 使用本地 jar?
我的 Applet 应用程序需要有一些依赖项(66Mb 的 jars)。用户之前可以安装 jars,但我如何从小程序中使用它们?
我可以将它们保存到默认位置 c:/myApp 和 /usr/local/myApp
我尝试加载它们:
ClassLoader loader = URLClassLoader.newInstance(
new URL[]{new URL("file://" + path + "/xuggle-xuggler-5.2.jar")},
JNLP2Manager.getCurrentManager().getAppletClassLoader()
);
Thread.currentThread().setContextClassLoader(loader);
但是 jar 不会自动添加到类路径中,我的意思是,我仍然必须单独加载每个类。
执行以下工作:
Class cls = loader.loadClass("com.xuggle.xuggler.video.ConverterFactory");
String testString = ConverterFactory.XUGGLER_ARGB_32;
但是我可以将所有类都添加到小程序加载器中吗?
PS 我知道我不应该使用 Applet ,但 Applet 仍然最适合我的应用程序。