javascript
Brief description  about Online courses   join in Online courses
View Priti m naik 's Profile

error exception thread

import java.applet.*;
import java.awt.*;
import java.awt.event.*;
/*<applet code="Moon" height="500" width="500"></applet>*/
class Moon extends Applet implements Runnable{

Thread t;
int x=260,y=150;
public void init(){
t = new Thread(this,"Moon");
t.start();
setBackground(Color.black);
setForeground(Color.white);
}
public void run(){

while(true) {

if(x==140)x=260;

x-=20;

try
{
Thread.sleep(1000);
}
catch(InterruptedException e){}

repaint();
}

}
public void paint(Graphics g) {
g.fillOval(140,150,100,100);
g.setColor(Color.black);
g.fillOval(x,y,100,100);

}
}


this is my progrom seems to be giving me an error
exception in thread java.lang.NoClassDefFoundError

its been bothering me since very long plz ..i cant even proceed to the other assignments
Asked by Priti m naik | Jan 14, 2011 |  Reply now
Replies (1)
View arun kumar das 's Profile
Hi

same program compile with >javac Moon.java
and run with > appletviewer Moon.java

than it will give out put, because this applet program.

one more way to run applet with HTML.

java teacher
Jan 17, 2011