Topic: 已配classpath Exception in thread "main" java.lang.NoClassDefFoundError:

  Print this page

1.已配classpath Exception in thread "main" java.lang.NoClassDefFoundError: Copy to clipboard
Posted by: doraemon
Posted on: 2004-07-23 14:36

新手
在用java application学helloworld时碰到
环境变量止设了class .;d:\jdk1.3.1\lib;
没设path,执行时在d:\jdk1.3\bin中直接执行
javac.exe HelloWordlApp.java 可以正常编译
但java HelloWorldApp 却报错:Exception in thread "main" java.lang.NoClassDefFoundError: e:\doraemon\java\javaexercise\HelloWorldApp

2.Re:Exception in thread "main" java.lang.NoClassDefFoundError: [Re: doraemon] Copy to clipboard
Posted by: doraemon
Posted on: 2004-07-23 14:38

再问一句,ie支持jdk1.4.2吗

3.Re:已配classpath Exception in thread "main" java.lang.NoClassDefFoundError: [Re: doraemon] Copy to clipboard
Posted by: SnakeX
Posted on: 2004-07-25 14:47

application? 那就不能在DOS下输出了啊~ 用IDE开发环境玩吧~

4.Re:已配classpath Exception in thread "main" java.lang.NoClassDefFoundError: [Re: doraemon] Copy to clipboard
Posted by: gj595
Posted on: 2004-07-29 17:36

请配置CLASSPATH后可使用

5.Re:已配classpath Exception in thread "main" java.lang.NoClassDefFoundError: [Re: doraemon] Copy to clipboard
Posted by: breezehou
Posted on: 2004-07-30 16:16

对,CLASSPATH没设置,不时class。

6.Re:已配classpath Exception in thread "main" java.lang.NoClassDefFoundError: [Re: doraemon] Copy to clipboard
Posted by: railgunman
Posted on: 2004-08-01 11:53

呵呵……终于找到问题的答案了

7.Re:已配classpath Exception in thread "main" java.lang.NoClassDefFoundError: [Re: doraemon] Copy to clipboard
Posted by: haoyue
Posted on: 2004-08-01 15:00

我的做法是设置Adminsitrator的用户变量(U):

1。JAVA_HOME=c:\j2sdk1.4.2-05
2。PATH=%JAVA_HOME%\bin;%PATH%
3。CLASSPATH=.;%JAVA_HOME%\lib

楼主的问题主要是忘记了添加Classpath中的".;"
"."表示的是当前目录

8.Re:已配classpath Exception in thread "main" java.lang.NoClassDefFoundError: [Re: doraemon] Copy to clipboard
Posted by: railgunman
Posted on: 2004-08-04 18:21

谢谢楼上,我的问题才真正得到解决!
不过,我还是有点不明白为什么按前面的解决办法不行,而设了这三个变量后就行了呢?


   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