The Windows XP work station I use in my lab does not have J2SE
installed. It only has the JRE of version. 1.4.2_08 installed. Look:
C:\Documents and Settings\antonyliu>java -version
java version "1.4.2_08"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_08-b03)
Java HotSpot(TM) Client VM (build 1.4.2_08-b03, mixed mode)
C:\Documents and Settings\antonyliu>
I don't wanna go through the hassle to ask the administrator of my
windows work station to install the newest J2SE package. So, I
installed JDK1.5 under my home directory C:\Documents and
Settings\antonyliu\jdk1.5
I've set the PATH, CLASSPATH and JAVA_HOME to point to this jdk1.5
folder. Look:
PATH=%PATH%;C:\Documents and Settings\antonyliu\jdk1.5\bin
CLASSPATH=%CLASSPATH%;C:\Documents and Settings\antonyliu\jdk1.5\lib
JAVA_HOME=C:\Documents and Settings\antonyliu\jdk1.5
But whenever I run java -version, it still shows me the old one. So,
is it possible to specify a JRE different from the system default?
Thanks.
Andrew Thompson - 08 Oct 2006 07:08 GMT
> The Windows XP work station I use in my lab does not have J2SE
> installed. It only has the JRE of version. 1.4.2_08 installed. ...
....
> I don't wanna go through the hassle to ask the administrator of my
> windows work station to install the newest J2SE package.
Administering the system is the *job* of the Sys. Admin.,
and they are likely to take regular measures to ensure the
workstations under their care are cleared of 'unauthorised'
applications - most simply by reinstalling the 'base' system
afresh.
(My advice) Stop trying to fight them, but instead convince
them of the necessity of keeping Java up to date.
Andrew T.
Manish Pandit - 08 Oct 2006 09:29 GMT
Most probably, your existing path (%PATH%) has the 1.4 release - that
could be why your version is not being picked. Assuming you can change
the path, put the path to 1.5 JDK before %PATH% and see if that works.
Another thing - If you are using something like eclipse for your java
development, you can configure it to point to 1.5 release, and it will
pick everything up from there. As long as you are writing, compiling
and running the java code within eclipse, you would not have to worry
about setting paths. I believe other IDEs have something similar as
well.
-cheers,
Manish
Thomas Kellerer - 08 Oct 2006 09:35 GMT
antonyliu2002@yahoo.com wrote on 08.10.2006 06:05:
> The Windows XP work station I use in my lab does not have J2SE
> installed. It only has the JRE of version. 1.4.2_08 installed. Look:
[...]
> I've set the PATH, CLASSPATH and JAVA_HOME to point to this jdk1.5
> folder. Look:
[quoted text clipped - 5 lines]
> But whenever I run java -version, it still shows me the old one. So,
> is it possible to specify a JRE different from the system default?
When the JRE is installed, it puts a version of java.exe and javaw.exe into
c:\Windows\System32
I guess that's the one beeing executed. You have three choices: either delete
those two files, but I doubt that you have the necessary user rights for that.
Change your path definition to include your homepath _before_ the regular PATH
varaible (PATH=C:\Documents and Settings\antonyliu\jdk1.5\bin;%PATH%)
Simply call "your" java.exe directly by specifying it's location.
Btw: I would not set the CLASSPATH, this is usually not necessary nowadays. That
should be handled when calling your app with the -cp switch
Thoams
Brandon McCombs - 08 Oct 2006 22:04 GMT
> The Windows XP work station I use in my lab does not have J2SE
> installed. It only has the JRE of version. 1.4.2_08 installed. Look:
[quoted text clipped - 22 lines]
>
> Thanks.
The OS is finding java in the first place it can which is in the 1.4
directory. If you place the 1.5 directory in front of the existing 1.4
location in the path then it will be found first and thus be used.
PATH=C:\Documents and Settings\antonyliu\jdk1.5\bin;%PATH%