初学问题

[复制链接]
查看11 | 回复1 | 2005-10-30 17:05:33 | 显示全部楼层 |阅读模式
我初学习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();

}
}
回复

使用道具 举报

千问 | 2005-10-30 17:05:33 | 显示全部楼层
java -classpath . Rectangle
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行