classpath帮助 [英] classpath help

查看:73
本文介绍了classpath帮助的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,


我正试图从这个链接运行示例程序:


http:// java。 about.com/od/tutorials/ss/SetClasspath.htm


它运行正常..现在的问题是......如果我不想使用set classpath命令,相反,我只想在我的系统环境变量中设置类路径,以便每次运行程序时,我只需输入javac文件然后输入java文件。我试着在环境变量中设置它:


变量名:classpath

变量值:c:\ javatest


但它没有用......有人可以帮我吗?


谢谢,

Pupoy

Hi All,

I''m trying to run a sample program from this link:

http://java.about.com/od/tutorials/ss/SetClasspath.htm

it worked fine.. now the problem is... what if i do not want to use the set classpath command, instead, i just want to set the classpath in my system environment variable so that everytime i run the program, i''ll just type javac file then java file. I tried to set this in the environment variable :

variable name: classpath
variable values: c:\javatest

but its not working... can anyone help me with this?

Thanks,
Pupoy

推荐答案

您能否使用-classpath标志向我们展示您最初设置的内容?对于

环境版本,所有内容都类似:作为标志:


-classpath = foo


和as一个环境变量:


set classpath = foo


亲切的问候,


Jos
Can you show us what you originally set using the -classpath flag? For the
environment version everything is similar: as a flag:

-classpath=foo

and as an environment variable:

set classpath=foo

kind regards,

Jos


嗨Jos,


感谢您的回复...我试图在命令行中输入:


第1步:设置PATH = c:\ program Files \ Java \ _ddk1.6.0_03 \ bin


第2步:javac C:\ javatest \ BarkingDogs.java


(然后指定在哪里找到类)


STEP3:java -cp c:\ javatest BarkingDogs <完成这些步骤后
...我成功完成了一段代码...


现在,如果我是我,请纠正我错误......我只需输入以下命令即可运行程序是正确的:

*(用于编译)

javac BarkingDogs.java


* (用于运行程序)

java BarkingDogs


意味着只需执行步骤2和3(步骤3中没有cp字)来运行程序,因为类路径是已经在环境变量中了。


回到原来的问题...我刚刚在系统环境变量下添加:


变量名:classpath

变量值:?


我正在使用windows xp


谢谢,

Pupoy
Hi Jos,


Thanks for the reply... i tried to type this in the command line :

STEP1 : set PATH = c:\program files\Java\jdk1.6.0_03\bin

STEP2 : javac C:\javatest\BarkingDogs.java

(Then specify where to find the class)

STEP3 : java -cp c:\javatest BarkingDogs

after completing these steps... i had a successful ran of the snippet...

Now, correct me if i''m wrong...is it correct that i can run the program by just typing :
* (for compiling)
javac BarkingDogs.java

* (for running program)
java BarkingDogs

meaning running the program by just doing steps 2 and 3(without cp word in step 3) since class path is already in environment variable.

Back to the original question... i just added under system environment variables :

variable name: classpath
variable value: ?

i''m using windows xp

Thanks,
Pupoy


你的推理一切都很健全,但你必须特别注意

那些带有空格的路径名。你需要使用双引号

否则MS Windows开始变得富有创意而你不想要。


亲切的问候,


Jos
Your reasoning is all sound and solid but you have to pay special attention to
those path names with spaces in them. You need to use double quotes around
them otherwise MS Windows starts to be creative which you don''t want.

kind regards,

Jos


这篇关于classpath帮助的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆