Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

applet loading problem

 
Milindkumar Shah
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello to all,

when i try to load applet in browser i got this error :


Java Plug-in 1.5.0
Using JRE version 1.5.0 Java HotSpot(TM) Client VM
User home directory = C:\Documents and Settings\milind


----------------------------------------------------
c: clear console window
f: finalize objects on finalization queue
g: garbage collect
h: display this help message
l: dump classloader list
m: print memory usage
o: trigger logging
p: reload proxy configuration
q: hide console
r: reload policy configuration
s: dump system and deployment properties
t: dump thread list
v: dump thread stack
x: clear classloader cache
0-5: set trace level to <n>
----------------------------------------------------

load: 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

my Dir. structure is

WEB-INF/classes/applet/TestApplet.class

and code in html is
<applet alt="not load" class="applet.TestApplet.class" height="200" width="200"></applet>
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nothing inside of WEB-INF will be served by the servlet container. You need to keep the class files (the "applet" directory in this case) in the directory that contains the HTML files.
 
Milindkumar Shah
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello,
Thanks for Reply but still the problem is not solved
now my Dir. Structure is

Inside my App called AppletDemo
folder called WebRoot/applet/TestApplet.class
and my jsp filed located at
WebRoot/jsp/displayApplet.jsp

and code inside the jsp file is

<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Wel come to Applet world</title>
</head>
<body>
<table width="100%">
<tr><td align="center">Wel come Milind</td></tr>
<tr>
<td width="100%" align="center">
<applet code="applet.TestApplet.class" width=400 height=400 >
</applet>
</td>
</tr>
</table>
</body>
</html>

Kindly guide me because i try lot for this but i am not finding solution
Thanks
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to keep the class files (the "applet" directory in this case) in the directory that contains the HTML files.


For "HTML" substitute "JSP" in your case.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic