I have this code:
document.write("<APPLET CODE='com/synergex/My.class' ARCHIVE='toc2.jar' ");
When my "toc2.jar" is in the same folder as the HTML - all works fine.
But when I put "toc2.jar" in another folder ("C:\\MyJars"), I get ClassNotFoundException
.
How can I "tell" the browser where to look for jars?
I tried to add "C:\\MyJars" or "C:\\MyJars\\toc2.jar" to my CLASSPATH
env variable, but it did not work.
You might be able to redirect the code base using an HTML base
element .
For example, given the following
BASE
declaration andA
declaration:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<HTML>
<HEAD>
<TITLE>Our Products</TITLE>
<BASE href="http://www.aviary.com/products/intro.html">
</HEAD>
<BODY>
<P>Have you seen our <A href="../cages/birds.gif">Bird Cages</A>?
</BODY>
</HTML>
the relative URI
"../cages/birds.gif"
would resolve to:
http://www.aviary.com/cages/birds.gif
If not, there are only 2 options.
codebase='../path/'
immediately after it, to tell the JRE to wherever the Jar is located. As an aside:
CODE='com/synergex/My.class'
Should be:
CODE='com.synergex.My'
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.