Topic: 在Prompt下java javaname出现错误!求救???

  Print this page

1.在Prompt下java javaname出现错误!求救??? Copy to clipboard
Posted by: nationalist
Posted on: 2006-07-28 14:12

很简单的程序
public class Hello {
public static void main(String[] args)
  {
   System.out.println("HelloWorld");
   System.exit(0);
   }
}
当在命令提示符下 javac Hello.java 的时候可以编译成功生成Hello.class文件
但是当java Hello的时候它的错误提示是
Exception in thread "main" java.lang.NoClassDefFoundError:Hello

补充一下,如果我用Eclipse开发的时候就不会有这种问题出现?请问是什么原因?

2.Re:在Prompt下java javaname出现错误!求救??? [Re: nationalist] Copy to clipboard
Posted by: why
Posted on: 2006-07-28 18:19

CLASSPATH !
Please do a search (for NoClassDefFoundError) before you post this kind of question.

java -cp . Hello

OR

SET CLASSPATH=.
java Hello


   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923