Topic: 请教高手我的java运行的到底是哪个?

  Print this page

1.请教高手我的java运行的到底是哪个? Copy to clipboard
Posted by: woodworm
Posted on: 2004-02-01 20:39

我的机器上装的有jdk1.4.1_01和JBuilder X.
我的系统的Path设的是jdk1.4.1_01的路径。
我在cmd下运行的时候,发现javac -verbose 时,使用的是1.4.1的javac。
但是用java -version查看java的版本时,却显示的是jb x下的1.4.2。用-verbose参数时,也显示调用的是jb x下的java文件和rt.jar。
请问哪问能指教一下到底这是怎么回事。如何更改设置可以控制到底使用那个路径下那个版本的java文件。

2.Re:请教高手我的java运行的到底是哪个? [Re: woodworm] Copy to clipboard
Posted by: whisperwind
Posted on: 2004-02-04 22:28

将你要用的JDK的BIN目录名添加到名字为Path的环境变量中

3.Re:请教高手我的java运行的到底是哪个? [Re: woodworm] Copy to clipboard
Posted by: woodworm
Posted on: 2004-02-12 19:43

这样是不起作用的

4.Re:请教高手我的java运行的到底是哪个? [Re: woodworm] Copy to clipboard
Posted by: Jove
Posted on: 2004-02-12 19:57

设置
JAVA_HOME=...
PATH=%JAVA_HOME%/bin;...

删除system32下的java.exe,javaw.exe

这样cmd中敲入java命令,肯定是JAVA_HOME里的
要换个jdk,也只要把这个变量改一改,PATH由于只是引用它,不需要修改

屡试不爽

5.Re:请教高手我的java运行的到底是哪个? [Re: woodworm] Copy to clipboard
Posted by: newnewworm
Posted on: 2004-02-14 10:12

在命令行的编译运行的
应该是在环境变量设置好的!

6.Re:请教高手我的java运行的到底是哪个? [Re: woodworm] Copy to clipboard
Posted by: aska0865
Posted on: 2004-02-14 12:19

At the DOS command prompt enter the command to set the environment variable PATH to include the directory where the JDK commands (javac, java etc.) are.
SET PATH=c:\jdk1.4.1_01\bin;%PATH%

At the dos command prompt enter the command
javac Hello.java

to compile your Java program into a bytecode file that will be named Hello.class. When the dos prompt returns, enter the dir command and the file Hello.class should be listed. Note that the java programs (javac, java) are case-sensitive.
At the dos command prompt enter the command
java Hello

to run the Java program. The string "Hello World!" will be displayed. Congratulations, you have just compiled and run your first Java program.
Notice that the name of the file, Hello.class, and the name of the class are both Hello. This is not a coincidence; they must be the same. The source file, Hello.java, is also named Hello. The Java language does not require that the source file have the name of the class though usually it is a good idea to have them be the same for readability.

7.Re:请教高手我的java运行的到底是哪个? [Re: woodworm] Copy to clipboard
Posted by: java3
Posted on: 2004-02-14 23:01

算是看得懂!!

8.Re:请教高手我的java运行的到底是哪个? [Re: Jove] Copy to clipboard
Posted by: woodworm
Posted on: 2004-02-17 21:45

Jove wrote:
设置
JAVA_HOME=...
PATH=%JAVA_HOME%/bin;...

删除system32下的java.exe,javaw.exe

这样cmd中敲入java命令,肯定是JAVA_HOME里的
要换个jdk,也只要把这个变量改一改,PATH由于只是引用它,不需要修改

屡试不爽


以前记得看过类似的关于system32的文章,居然现在忘的死死的。
谢谢指教


   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