2、如果一臺(tái)電腦安裝兩套以上的JRE,誰(shuí)來(lái)決定呢?
這個(gè)重大任務(wù)就落在java.exe身上。Java.exe的工作就是找到合適的JRE來(lái)運(yùn)行Java程序。
java.exe依照底下的順序來(lái)查找JRE:
自己的目錄下有沒(méi)有JRE;
父目錄有沒(méi)有JRE;
查詢注冊(cè)表:
[HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment]
所以java.exe的運(yùn)行結(jié)果與你的電腦里面哪個(gè)JRE被執(zhí)行有很大的關(guān)系。
1) Not exactly, java executable is part of one JRE on your path. Unless you put java (.exe?? There is no java.exe on unix) somewhere else.
2) Another problem is if you put two imcompatable JREs on your machine, it might cause your ObjectInputStream corrupted.
3) For developer‘s machine, j2sdk without another JRE is the best choice.
Add one more:
Even j2sdk (JDK is the old name) is free, but it is illegal to distribute j2sdk with your product. Therefore if your product required j2sdk to run. Then you must require your client to download it from Sun and install it before instalation of your product. What a headache!
On the opposite, you can distribute JRE with your application freely.
javac is Sun‘s version of java compiler, not a wrapper. Like any other executables, it uses other libraries such as some dll on windows, some shared libraies on Unix. It also uses some jar files came with it. That is just how it is, and how it works.
It is quite normal, Isn‘t it? javachina wrote:
1) Not exactly, java executable is part of one JRE on your path. Unless you put java (.exe?? There is no java.exe on unix) somewhere else.
2) Another problem is if you put two imcompatable JREs on your machine, it might cause your ObjectInputStream corrupted.
3) For developer‘s machine, j2sdk without another JRE is the best choice.
java -cp c:\jdk\lib\tools.jar com.sun.tools.javac.Main
javachina wrote:
1) Not exactly, java executable is part of one JRE on your path. Unless you put java (.exe?? There is no java.exe on unix) somewhere else.
2) Another problem is if you put two imcompatable JREs on your machine, it might cause your ObjectInputStream corrupted.
3) For developer‘s machine, j2sdk without another JRE is the best choice.
java -cp c:\jdk\lib\tools.jar com.sun.tools.javac.Main
Trackback: http://tb.blog.csdn.net/TrackBack.aspx?PostId=360157
聯(lián)系客服