Topic: 如何设置环境变量(急!!!)

  Print this page

1.如何设置环境变量(急!!!) Copy to clipboard
Posted by: chair
Posted on: 2005-09-14 16:11

我写了一个程序,编译通过,无法运行.提示出错:
Exception in thread "main" java.lang.NoClassDefFounfError: f:\java\hello
我写的程序在F盘下.j2sdk1.4.2_09装在C盘.在网上看了很多类似的帖,应该是环境变量没有设置正确.我是这样设置的(系统是windows xp2 )
变量名:path 变量值:c:\j2sdk1.4.2_09\bin
变量名:java_home 变量值:c:\j2sdk1.4.2_09
变量名:clsaapath 变量值:c:\j2sdk1.4.2_09\lib\tools.jar;c:\j2sdk1.4.2_09\jre\lib\rt.jar
急!!!请各位大虾救命

2.Re:如何设置环境变量(急!!!) [Re: chair] Copy to clipboard
Posted by: nonamexz
Posted on: 2005-09-14 16:20

classpath 变量值:

.;f:\java;


path 变量值:

c:\j2sdk1.4.2_09\bin

3.Re:如何设置环境变量(急!!!) [Re: chair] Copy to clipboard
Posted by: chair
Posted on: 2005-09-14 16:44

classpath 设置成.;f:\java还是不行,高手救,这是写的第一个程序

4.Re:如何设置环境变量(急!!!) [Re: chair] Copy to clipboard
Posted by: nonamexz
Posted on: 2005-09-14 16:50

你把当前目录设为"F:\java\"
再执行
java hello
试试.

5.Re:如何设置环境变量(急!!!) [Re: chair] Copy to clipboard
Posted by: chair
Posted on: 2005-09-14 17:11

还是不行,鼓励鼓励我,怎么弄一个这么难的环境变量,其他的编程语言好象不要

6.Re:如何设置环境变量(急!!!) [Re: chair] Copy to clipboard
Posted by: chair
Posted on: 2005-09-14 17:14

why 你在哪,帮帮我

7.Re:如何设置环境变量(急!!!) [Re: chair] Copy to clipboard
Posted by: zcjl
Posted on: 2005-09-14 19:15

set classpath=.

8.Re:如何设置环境变量 [Re: chair] Copy to clipboard
Posted by: why
Posted on: 2005-09-14 19:49

Is your class hello and the java file hello.java -- if it is Hello, then it has to be Hello.java.

Please run the following commands and copy-n-paste the contents in the Command Prompt window into your post:
> echo %JAVA_HOME%
> echo %PATH%
> echo %CLASSPATH%
> F:
> cd \java
> dir
> javac hello.java
> java -cp . hello

(to cut-n-paste, select the area to capture with the mouse and press ENTER)

BTW, please don't write something like(急!!!)in the subject line, I found it annoying, if not disgusting.

9.Re:如何设置环境变量(急!!!) [Re: chair] Copy to clipboard
Posted by: nonamexz
Posted on: 2005-09-14 21:58

chair:
建议你下载(Java深度歷險 Chapter1 )
http://www.javaworld.com.tw/jute/upload/moli/j2me_book/inside_java_ch01.pdf
把这篇文章仔细看一下,估计以后这方面的问题就再也难不到你了。
我也是java新手,有空多交流交流。

10.Re:如何设置环境变量(急!!!) [Re: nonamexz] Copy to clipboard
Posted by: normanzeng
Posted on: 2005-09-14 22:27

nonamexz wrote:
chair:
建议你下载(Java深度歷險 Chapter1 )
http://www.javaworld.com.tw/jute/upload/moli/j2me_book/inside_java_ch01.pdf
把这篇文章仔细看一下,估计以后这方面的问题就再也难不到你了。
我也是java新手,有空多交流交流。


这篇文章真的好啊!!! 本周刚开始学java, 对我的帮助太大了!!!!
现在开始搞eclipse, 如果搞不定再来这里找人帮忙.

11.Re:如何设置环境变量(急!!!) [Re: chair] Copy to clipboard
Posted by: jjl0604
Posted on: 2005-09-14 22:31

classpath
.;c:\j2sdk1.4.2_09\lib\tools.jar;c:\j2sdk1.4.2_09\jre\lib\rt.jar

12.Re:如何设置环境变量(急!!!) [Re: jjl0604] Copy to clipboard
Posted by: why
Posted on: 2005-09-14 22:41

jjl0604 wrote:
classpath
.;c:\j2sdk1.4.2_09\lib\tools.jar;c:\j2sdk1.4.2_09\jre\lib\rt.jar

多謝參與,但請勿混淆視聽Sad

13.Re:如何设置环境变量(急!!!) [Re: chair] Copy to clipboard
Posted by: chair
Posted on: 2005-09-15 06:41

我已经解决了,看了清华大学的JAVA2实用教程中说是这样,在命令提示符下输入:path c:\j2sdk1.4.2_09\bin 后进入f:\java\hello java hello终于出现hello java world!  谢谢大家帮助!!!

14.Re:如何设置环境变量(急!!!) [Re: chair] Copy to clipboard
Posted by: why
Posted on: 2005-09-15 06:55

chair wrote:
我已经解决了,看了清华大学的JAVA2实用教程中说是这样,在命令提示符下输入:path c:\j2sdk1.4.2_09\bin 后进入f:\java\hello java hello终于出现hello java world!  谢谢大家帮助!!!

进入f:\java\hello ?
Show us your code -- you should do this at the very beginning!

15.Re:如何设置环境变量(急!!!) [Re: jjl0604] Copy to clipboard
Posted by: liumengyong
Posted on: 2005-09-15 09:11

在我的电脑,右键-属性-环境变量
.;c:\j2sdk1.4.2_09\lib\tools.jar;c:\j2sdk1.4.2_09\jre\lib\rt.jar

16.Re:如何设置环境变量(急!!!) [Re: liumengyong] Copy to clipboard
Posted by: why
Posted on: 2005-09-15 10:32

liumengyong wrote:
在我的电脑,右键-属性-环境变量
.;c:\j2sdk1.4.2_09\lib\tools.jar;c:\j2sdk1.4.2_09\jre\lib\rt.jar

Sigh...
Could you please tell us why we need to include tools.jar and rt.jar in the classpath?

17.救命啊~当头棒喝~~~~! [Re: chair] Copy to clipboard
Posted by: solar009
Posted on: 2005-09-16 18:12

我的java 才装上 用java -version 显示的是虚拟机已经安装好了 可是编译的时候却是说找不到要编译的文本~我晕死了 !用dir有能看见txt文件~大虾们帮帮忙啊~谢谢~

18.Re:如何设置环境变量(急!!!) [Re: chair] Copy to clipboard
Posted by: yuzili2003
Posted on: 2005-09-16 20:03

将你编的*.txt文件保存成*.java文件
文件名要和类名一致


   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