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..