Topic: helloworld程序运行错误:NoClassDefFoundError: HelloWorld/java

  Print this page

1.helloworld程序运行错误:NoClassDefFoundError: HelloWorld/java Copy to clipboard
Posted by: hemk
Posted on: 2005-11-15 13:40

我测试的一段小程序:
public class HelloWorld

{
public static void main(String args[])

{
System.out.println("Hellow world in Java!");
}
}
用javac编译正常,但运行出现下面错误:
"Excetipn in thread "main" java.lang.No ClassDeffoundError: HelloWorld/java"
按照资料说明,设置了环境变量,也是一样.

请各位大虾帮忙.


请尽量使用准确的文字描述作为标题
(甚至只是简单的错误信息)

不妨先搜寻一下旧帖子 http://www.cjsdn.net/post/search
说不定已找到答案 keyword: NoClassDefFoundError

原來的标题:
小学生问题再发生!(

2.Re:小学生问题再发生! [Re: hemk] Copy to clipboard
Posted by: q_yuan
Posted on: 2005-11-15 14:31

你检查一下Path设置是否正确!

3.Re:小学生问题再发生! [Re: hemk] Copy to clipboard
Posted by: bukaoyan
Posted on: 2005-11-15 14:43

应该是.的问题

4.Re:小学生问题再发生! [Re: hemk] Copy to clipboard
Posted by: hemk
Posted on: 2005-11-15 17:51

确认未发现异样,PATH设置与书上,网上相同,但对CLASS_PATH设置,我不能确定,我看了几个说法不一样。
请告之。
谢谢!

5.Re:小学生问题再发生!(NoClassDeffoundError: HelloWorld/java) [Re: hemk] Copy to clipboard
Posted by: why
Posted on: 2005-11-15 20:13

hemk wrote:
确认未发现异样,PATH设置与书上,网上相同,但对CLASS_PATH设置,我不能确定,我看了几个说法不一样。

CLASS_PATH? It's CLASSPATH

How did you run HelloWorld?
  java HelloWorld.java
??Dead

Try
  java -cp . HelloWorld


q_yuan wrote:
你检查一下Path设置是否正确!

Path设置?
Could you please tell us why one should check this when getting a NoClassDefFoundError?

6.Re:helloworld程序运行错误:NoClassDefFoundError: HelloWorld/java [Re: hemk] Copy to clipboard
Posted by: hemk
Posted on: 2005-11-16 11:23

谢谢!各位帮助.我已经解决了问题.
原来在public static void main(String args[])中String [] args中括弧位置不对.

7.Re:helloworld程序运行错误:NoClassDefFoundError: HelloWorld/java [Re: hemk] Copy to clipboard
Posted by: why
Posted on: 2005-11-16 17:29

hemk wrote:
谢谢!各位帮助.我已经解决了问题.
原来在public static void main(String args[])中String [] args中括弧位置不对.

No no no
public static void main(String args[])
and
public static void main(String[] args)
are the same.

8.Re:helloworld程序运行错误:NoClassDefFoundError: HelloWorld/java [Re: hemk] Copy to clipboard
Posted by: kof821117
Posted on: 2005-11-17 09:08

可以运行啊,,我用的bluej运行的,

9.Re:helloworld程序运行错误:NoClassDefFoundError: HelloWorld/java [Re: why] Copy to clipboard
Posted by: xiaosilent
Posted on: 2005-11-17 13:57

why wrote:
No no no
public static void main(String args[])
and
public static void main(String[] args)
are the same.


   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