Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
  • Piet Souris
  • Frits Walraven
  • Carey Brown

java: ClassNotFoundException

Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
<TITLE> New Document </TITLE>
<APPLET CODE="FirstApplet.class" width="150" height="150">
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 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 Source)
at Source)
Caused by: open HTTP connection failed.
at sun.applet.AppletClassLoader.getBytes(Unknown Source)
at sun.applet.AppletClassLoader.access$100(Unknown Source)
at sun.applet.AppletClassLoader$ Source)
at 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..
Ranch Hand
Posts: 299
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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:

    Bookmark Topic Watch Topic
  • New Topic