File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Applets and the fly likes java: ClassNotFoundException Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Applets
Bookmark "java: ClassNotFoundException" Watch "java: ClassNotFoundException" New topic
Author

java: ClassNotFoundException

Amit More
Greenhorn

Joined: Oct 16, 2003
Posts: 24
Hi Friends,
I have written a simple applet which looks like:
-----------------------------------------------------------
import java.applet.Applet;
import java.awt.Graphics;
public class FirstApplet extends Applet
{
public FirstApplet()
{
}
public void paint(Graphics g)
{
g.drawString("Hellow World", 25, 50);
}
-----------------------------------------------------------
And to run this applet the required html code is
-----------------------------------------------------------
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF">
<APPLET CODE="FirstApplet.class" width="150" height="150">
</APPLET>
</BODY>
</HTML>
-----------------------------------------------------------
On Local machine when I am trying to open the html file, it loads the applet and works fine.
But now if I am putting all these on server (Apache-Tomcat) and trying to execute it then it gives me the error in java console as:
Java(TM) Plug-in: Version 1.4.0_03
Using JRE version 1.4.0_03 Java HotSpot(TM) Client VM
User home directory = C:\WINNT\Profiles\am007431.MAHINDRABT
----------------------------------------------------
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 properties
t: dump thread list
x: clear classloader cache
0-5: set trace level to <n>
----------------------------------------------------
load: class FirstApplet.class not found.
java.lang.ClassNotFoundException: FirstApplet.class
at sun.applet.AppletClassLoader.findClass(Unknown Source)
at sun.plugin.security.PluginClassLoader.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)
... 11 more

------------------------------------------------
I put my class file in '/WEB-INF/classes' folder and instead of html page I am using jsp page which is in '/jsp' folder.
Can any one help me out to solve this problem.
It's urgent !
Thanks in advance..


Thanks,<br />Amit
Brian Pipa
Ranch Hand

Joined: Sep 29, 2003
Posts: 299
/WEB-INF/classes
is for classes used by the servlets and/or JSPs. It's not the place to put applet code. Try putting the applet class in the same dir as the jsp (is the /jsp folder).
A better idea even would be to have /jsp and /applet directories. Put hte jsp in the /jsp dir and put the applet code in the /applet dir then in the jsp you would have:

Brian


My Java Freeware:<br />MACCC - <a href="http://maccc.pipasoft.com" target="_blank" rel="nofollow">http://maccc.pipasoft.com</a><br />Nator - <a href="http://nator.pipasoft.com" target="_blank" rel="nofollow">http://nator.pipasoft.com</a>
 
Don't get me started about those stupid light bulbs.
 
subject: java: ClassNotFoundException
 
Similar Threads
ClassNotFoundException
playing audio in an applet and embedding that applet into a jsp or Html file
Setting applet path in Java Servlet
applet loading problem
how to execute applet through webserver