If you want to invoke a specific Java launcher and JVM, you can use an explicit path to that "java.exe" of
course. For example, on my PC as I showed you, there are about eight "java.exe" files in various copies of the
JRE, multiple JSDKs, and so on. So if I want to invoke the JDK 1.4.1 java explicitly on BlackBox (since I have the javaxcomm
support installed in my JDK 1.4.1 but not in every JRE on my system):
Temporarily (for this DOS command window session) add the BlackBox JAR to my classpath. Note that this only works if
this is really where the BlackBox JAR is...
set CLASSPATH=%JAVA_LIB%\commapi\samples\BlackBox\BlackBox.jar;%CLASSPATH%
Now invoke a specific java launcher:
D:\j2sdk14\bin\java BlackBox
In my case I used the verbose option to see if this really makes a difference in which java.exe gets used.
In the "whatever java.exe is in the registry" case:
D:\Docs>java -verbose BlackBox
[Opened C:\Program Files\Java\j2re1.4.1_01\lib\rt.jar]
[Opened C:\Program Files\Java\j2re1.4.1_01\lib\sunrsasign.jar]
[Opened C:\Program Files\Java\j2re1.4.1_01\lib\jsse.jar]
[Opened C:\Program Files\Java\j2re1.4.1_01\lib\jce.jar]
[Opened C:\Program Files\Java\j2re1.4.1_01\lib\charsets.jar]
[Loaded java.lang.Object from C:\Program Files\Java\j2re1.4.1_01\lib\rt.jar]
[Loaded java.io.Serializable from C:\Program Files\Java\j2re1.4.1_01\lib\rt.jar]
.... and so on
Now the explicit java invocation:
D:\Docs>D:\j2sdk14\bin\java -verbose BlackBox
[Opened D:\j2sdk14\jre\lib\rt.jar]
[Opened D:\j2sdk14\jre\lib\sunrsasign.jar]
[Opened D:\j2sdk14\jre\lib\jsse.jar]
[Opened D:\j2sdk14\jre\lib\jce.jar]
[Opened D:\j2sdk14\jre\lib\charsets.jar]
[Loaded java.lang.Object from D:\j2sdk14\jre\lib\rt.jar]
[Loaded java.io.Serializable from D:\j2sdk14\jre\lib\rt.jar]
So, the explicit invocation does make a difference.
Just for fun I tried this, with the default path being the location of the java.exe I want:
D:\j2sdk14\bin>java -verbose BlackBox
[Opened D:\j2sdk14\jre\lib\rt.jar]
[Opened D:\j2sdk14\jre\lib\sunrsasign.jar]
[Opened D:\j2sdk14\jre\lib\jsse.jar]
[Opened D:\j2sdk14\jre\lib\jce.jar]
[Opened D:\j2sdk14\jre\lib\charsets.jar]
[Loaded java.lang.Object from D:\j2sdk14\jre\lib\rt.jar]
And you should know what my classpath is too:
CLASSPATH=d:\java_lib\commapi\samples\BlackBox\BlackBox.jar;.;D:\java_lib\util\systronix_utils.jar;D:\jakarta-ant-1.5.1\lib;;D:\j2sdk14\lib\comm.jar;D:\aJile\Runtime_cldc\Rts;D:\tini1.11\bin;.;D:\java_lib\util\systronix_utils.jar;D:\jakarta-ant-1.5.1\lib;;d:\java_lib\onewire\OneWireAPI_J2ME.jar;D:\Amulet\Projects\applets\Widgets.jar;
and my path:
PATH=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\system32\WBEM;C:\Program Files\Common Files\Adaptec Shared\System;D:\jakarta-ant-1.5.1\bin;D:\j2sdk14\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\system32\WBEM;C:\Program
Files\Common Files\Adaptec Shared\System;
I've got some redundancy to clean up here, but the point is that the JRE is the only portion of the JSDK install which
contains runtime libraries such as rt.jar which you can see is where all the PC runtime classes reside. So the JRE folders
must always be referenced at runtime. But you don't need to have the javaxcomm classes in the JRE folders, as long as
you add the comm.jar to your classpath per the instructions on the PEJ book website. This is also the recommended installation
given in the javaxcomm installation instructions.
I'd be curious to see all the Java-related entries in the system registry, and it would be nice to understand how that
all relates too. |