本文介绍了Java小程序:如何告诉浏览器(Firefox),到哪里寻找库(罐)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我写了一个Java小程序类,并做了一个小的HTML页面通过在&lt包括它;小程序> -tag。
(这是此刻我的磁盘驱动器上本地运行)
这个效果很好,就是小程序被加载正确。
但小程序依赖于外部库(罐)。
例如。我进口org.apache.batik.swing.JSVGCanvas;
当然,我在这里有所有的罐子和测试在Eclipse中的小应用程序工作正常。
但是,浏览器(Firefox)似乎并没有找到罐子。
我如何告诉浏览器到哪里去寻找外部罐子?
我试图在用户的环境变量设置CLASSPATH。没有成功。
这是Windows XP,运行JRE 1.6。

I have written a Java applet class and made a small HTML page to include it via the <applet>-tag.(This is running locally on my disk drive for the moment)This works well, that is, the applet is being loaded properly.But the applet depends on external libraries (jars).E.g. i imported org.apache.batik.swing.JSVGCanvas;Of course, I have all the jars here and testing the applet from within Eclipse works fine.But the browser (Firefox) doesn't seem to find the jars.How do i tell the browser where to search for the external jars?I tried setting CLASSPATH in the user environment variables. without success.This is on windows XP, running JRE 1.6.

推荐答案

Applet是在客户机上执行的,所以在类路径中的库也无济于事。

Applet is executed in clients machine, so having libs in CLASSPATH won't help.

利布斯应在存档属性:

<applet code="Applet.class" archive="myApplet.jar,lib1.jar,lib2.jar" width="600" height="600" title="MyApplet">

这篇关于Java小程序:如何告诉浏览器(Firefox),到哪里寻找库(罐)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

11-03 03:15