开发者

Java applet: How to tell the browser (Firefox) where to look for libraries (jars)

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 (F开发者_C百科irefox) 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 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">


You need to specify the codebase attribute of the applet tag.

Have a look at how-to-specify-correctly-codebase-and-archive-in-java-applet.

It is similar to your question.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜