javascript - How does HTML java applet finds its .jar? -


i have code:

document.write("<applet code='com/synergex/my.class' archive='toc2.jar' "); 

when "toc2.jar" in same folder html - works fine.

but when put "toc2.jar" in folder ("c:\myjars"), classnotfoundexception.

how can "tell" browser jars?

i tried add "c:\myjars" or "c:\myjars\toc2.jar" classpath env variable, did not work.

you might able redirect code base using html base element.

for example, given following base declaration , a 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 seen our <a href="../cages/birds.gif">bird cages</a>?  </body> </html> 

the relative uri "../cages/birds.gif" resolve to:

http://www.aviary.com/cages/birds.gif

if not, there 2 options.

  1. leave jar in same directory html.
  2. presuming part of script thing cannot change, add codebase='../path/' after it, tell jre wherever jar located.

as aside:

code='com/synergex/my.class' 

should be:

code='com.synergex.my' 

Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -