Java 小程序:如何告诉浏览器 (Firefox) 在哪里查找库(jar)
我编写了一个 Java applet 类并制作了一个小型 HTML 页面以通过
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Applet 在客户端计算机中执行,因此在 CLASSPATH 中包含库不会有帮助。
库应该位于“archive”属性中:
Applet is executed in clients machine, so having libs in CLASSPATH won't help.
Libs should be in "archive" attribute:
您需要指定
applet
标记的codebase
属性。看看如何-在 java-applet 中正确指定代码库和归档。
这与你的问题类似。
You need to specify the
codebase
attribute of theapplet
tag.Have a look at how-to-specify-correctly-codebase-and-archive-in-java-applet.
It is similar to your question.