• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Cannot find applet class

 
Mason Zhao
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear all,
My web page needs using applet, I write a small class to test it, but I always
get exception. I am so confused why I can not open the http connection. I already turn firewall and Norton. By the way I use Tomcat 5.20, and my "TestApplet.class" in jar file is in packge "mason.applet.appletClasses.TestApplet.class".
<code>
oad: class TestApplet.class not found.
java.lang.ClassNotFoundException: TestApplet.class
at sun.applet.AppletClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.applet.AppletClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.applet.AppletClassLoader.loadCode(Unknown Source)
at sun.applet.AppletPanel.createApplet(Unknown Source)
at sun.plugin.AppletViewer.createApplet(Unknown Source)
at sun.applet.AppletPanel.runLoader(Unknown Source)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.io.IOException: open HTTP connection failed.
at sun.applet.AppletClassLoader.getBytes(Unknown Source)
at sun.applet.AppletClassLoader.access$100(Unknown Source)
at sun.applet.AppletClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
... 10 more
</cdoe>
My page code:
<code>
<html>
<head><title>Applet Practice</title></head>
<body>
<applet code="TestApplet.class" archive="AppletPractice.jar"
width=325 height=325>
</applet>
</body>
</html>
</code>
I am limited time for this work ,Please please give a hand!
Thank you in advance!

Mason
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24212
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
BY far the most common cause of this problem is mistakenly putting the Applet jar file into WEB-INF/lib, or something like that. That directory is for libraries to run on the server, while applets are downloaded and run on the client. The applet jar needs to be in a publically accessible place on the server, and the "archive" attribute needs to point to the specific URL where that jar file can be downloaded.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic