469,591 Members | 2,068 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,591 developers. It's quick & easy.

How to run Applet

Hi All

I got a problem in running java Applet

i am not able to run java applet while running i got a problem as
Loading Java Applet Failed

java.lang.NoClassDefFoundError: App (wrong name: src/App)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknow n Source)
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)

myhtml file is like this

Code:

<html>

<head>


<title>My Applet</title>



</head>


<body>

<h1>Network Applet</h1>

<APPLET CODE="App.class" CODEBASE = "\src" WIDTH=200 HEIGHT=50>


</APPLET>



</body>

</html>



the App.java file is
App.java

[code]
package src;
import java.awt.*;
import java.applet.*;
import javax.swing.JApplet;
public class App extends JApplet
{
public void paint(Graphics g)
{
g.drawString("Hello",100,100);
}
}

I kept the html file and App.class file in src directory...
so that i specified the CODEBASE in html file like CODEBASE = "\src"
i changed this in so many ways also but no use
i specified complete path of .class file also but it was not run for me..

my directory structure is

src----
app.java
app.class
myhtml.html

Iam using ant to build application so that i also set path to ant...
my jdk path settings are

CLASSPATH
C:\j2sdk1.4.2_12\bin;C:\j2sdk1.4.2_12\lib;
path
C:\ant\bin;C:\j2sdk1.4.2_12\bin;
JAVA_HOME
C:\j2sdk1.4.2_12
ANT_HOME
C:\ant

can anybody help me please.......I need it very much
Mar 9 '07 #1
0 1310

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

1 post views Thread by nathanlaan | last post: by
reply views Thread by James Hong | last post: by
1 post views Thread by Charlie Kim | last post: by
1 post views Thread by Tormod Omholt-Jensen | last post: by
2 posts views Thread by Roberto Gallo | last post: by
reply views Thread by ankur | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.