Exception in thread "main" java.lang.NoClassDefFoundError

来源:互联网 发布:淘宝网婚纱礼服2016款 编辑:程序博客网 时间:2024/04/28 06:36

 在命令行上执行java程序时出现如下错误:

Exception in thread "main" java.lang.NoClassDefFoundError

首先是编译成功。执行时出错。

 

原因是: 环境变量classpath没有设置对,以前把classpath设置成d:/java/jdk1.5.0/lib/tools.jar 就行了。

那是因为eclipse会自动设置classpath为当前目录。

如果没有eclipse等工具,就必须要在classpath里添加 .;

点代表当前目录。