Java 小程序:如何告诉浏览器 (Firefox) 在哪里查找库 (jar) [英] Java applet: How to tell the browser (Firefox) where to look for libraries (jars)

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

问题描述

我编写了一个 Java 小程序类,并制作了一个小的 HTML 页面以通过 <applet> 标签包含它.(目前在我的磁盘驱动器上本地运行)这很有效,即小程序正在正确加载.但是小程序依赖于外部库(jars).例如.我导入了 org.apache.batik.swing.JSVGCanvas;当然,我这里有所有的 jars 并且在 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 在客户端机器中执行,因此在 CLASSPATH 中使用库将无济于事.

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

库应该在存档"属性中:

Libs should be in "archive" attribute:

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

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

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆