我初学习java 按照教材的程序 编译完成后,运行时出现错误
Exception in thread "main" java.lang.NoclassDefFoundError:Rectangle
我已经设置了path和classpath 环境为Sun j2sdk1.4.0
代码:
class Rectangle {
private int x;
private int y;
private int width;
private int height;
public Rectangle(int x, int y, int width,int height) {
this.x=x;
this.y=y;
this.width=width;
this.height=height;
}
public void draw() {
System.out.println("Rectangle:"+x+","+y+","+width+","+height);
}
public static void main(String args[]){
Rectangle r1=new Rectangle(5,5,100,200);
Rectangle r2=new Rectangle(0,100,300,450);
r1.draw();
r2.draw();
}
}
|