Environment Variable for Java

Q

qazmlp

I have installed both JRE-1.2.2 & JRE-1.3.0_02 in my Win2k machine.
In both
control-panel->System->Advanced->Environment variables->User
variables->PATH
control-panel->System->Advanced->Environment variables->System
variables->PATH,
I have given the path for JRE-1.2.2 first,JRE-1.3.0_02 second and then
the other paths. But, if the JRE 1.3.0_02 is always considered. Why is
this so?

Then, when I checked for 'set PATH' in the command prompt, it displays
some other paths and then the paths for JRE-1.2.2,JRE-1.3.0_02.
"C:\WINNT\system32" was existing before the JRE paths and I could find
java.exe(1.3.0_02) in that path. That was the reason, why JRE 1.3.0_02
is always selected?

If path variables do not work, what is the way so that JRE-1.2.2 is
selected by default?
 
P

Pegasus \(MVP\)

qazmlp said:
I have installed both JRE-1.2.2 & JRE-1.3.0_02 in my Win2k machine.
In both
control-panel->System->Advanced->Environment variables->User
variables->PATH
control-panel->System->Advanced->Environment variables->System
variables->PATH,
I have given the path for JRE-1.2.2 first,JRE-1.3.0_02 second and then
the other paths. But, if the JRE 1.3.0_02 is always considered. Why is
this so?

Then, when I checked for 'set PATH' in the command prompt, it displays
some other paths and then the paths for JRE-1.2.2,JRE-1.3.0_02.
"C:\WINNT\system32" was existing before the JRE paths and I could find
java.exe(1.3.0_02) in that path. That was the reason, why JRE 1.3.0_02
is always selected?

If path variables do not work, what is the way so that JRE-1.2.2 is
selected by default?

To answer your question, the following information would be
required:
- Your actual path as seen in the Control Panel.
- Your path as seen in a Command Prompt.
- How exactly you invoke a Command Prompt.
- How exactly you determined that JRE-1.30_02 is treated preferentially
in a Command Prompt.
- If it is "JRE-1.30_02" or "JRE 1.30_02" (you oscillate between the two).
- If you rebooted after setting the new path in the Control Panel.
 
G

George Hester

Set these environment variables:

JAVA_HOME = the java SDK you want to use.
JAVA_PATH = the java SDK you want to use

I have Sun's JAVA SDK j2re1.4.2_02 with NetBeans:

JAVA_HOME = C:\Program Files\j2sdk_nb\j2sdk1.4.2
JAVA_PATH = C:\Program Files\j2sdk_nb\j2sdk1.4.2\

And for PATH variable I have appended:

C:\Program Files\j2sdk_nb\j2sdk1.4.2\bin
 
Q

qazmlp

Pegasus \(MVP\) said:
To answer your question, the following information would be
required:
- Your actual path as seen in the Control Panel.
User variable PATH:
C:\Program Files\JavaSoft\JRE\1.2\bin; C:\Program
Files\JavaSoft\JRE\1.3.0_02\bin;D:\TOOLS\SINT;c:\tools

System variable PATH:
C:\Program Files\JavaSoft\JRE\1.2\bin; C:\Program
Files\JavaSoft\JRE\1.3.0_02\bin;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\Program
Files\Rational\common;C:\atria\bin
- Your path as seen in a Command Prompt.
C:\Documents and Settings\GUIUser>set PATH
Path=\\NTSTORE\WINRUNNER7.5\arch;\\NTSTORE\WINRUNNER7.5\arch;C:\WINNT\system32
;C:\WINNT;C:\WINNT\System32\Wbem;C:\Program
Files\Rational\common;C:\atria\bin;C
:\Program Files\JavaSoft\JRE\1.2\bin; C:\Program
Files\JavaSoft\JRE\1.3.0_02\bin
;D:\TOOLS\SINT;c:\tools
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH
- How exactly you invoke a Command Prompt.
From Start->Run->Cmd
- How exactly you determined that JRE-1.30_02 is treated preferentially
in a Command Prompt?
Immediately after the command window opened, I typed, 'java -version'.

C:\Documents and Settings\GUIUser>java -version
java version "1.3.0_02"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0_02)
Java HotSpot(TM) Client VM (build 1.3.0_02, mixed mode)

One of the application that I use needs Java 1.2.2 and unfortunately
it does not work with 1.3.0_02. I have been using this application for
quite a long time. But, it stopped working imm. after I installed the
JRE 1.3.0_02.
Now, as I have 2 JRE versions in my machine, I wanted to give the Java
1.2.2 PATH first to make the Application to run.
- If it is "JRE-1.30_02" or "JRE 1.30_02" (you oscillate between the two). It is JRE 1.3.0_02.
- If you rebooted after setting the new path in the Control Panel.

After setting the Path, I just opened a new command line window from
Start->Run-Cmd.
Why should I reboot?

Thanks for your inputs!
 
P

Pegasus \(MVP\)

qazmlp said:
"Pegasus \(MVP\)" <[email protected]> wrote in message
User variable PATH:
C:\Program Files\JavaSoft\JRE\1.2\bin; C:\Program
Files\JavaSoft\JRE\1.3.0_02\bin;D:\TOOLS\SINT;c:\tools

System variable PATH:
C:\Program Files\JavaSoft\JRE\1.2\bin; C:\Program
Files\JavaSoft\JRE\1.3.0_02\bin;%SystemRoot%\system32;%SystemRoot%;%SystemRo
ot%\System32\Wbem;C:\Program
C:\Documents and Settings\GUIUser>set PATH
Path=\\NTSTORE\WINRUNNER7.5\arch;\\NTSTORE\WINRUNNER7.5\arch;C:\WINNT\system
32
;C:\WINNT;C:\WINNT\System32\Wbem;C:\Program
Files\Rational\common;C:\atria\bin;C
:\Program Files\JavaSoft\JRE\1.2\bin; C:\Program
Files\JavaSoft\JRE\1.3.0_02\bin
;D:\TOOLS\SINT;c:\tools
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH

From Start->Run->Cmd

Immediately after the command window opened, I typed, 'java -version'.

C:\Documents and Settings\GUIUser>java -version
java version "1.3.0_02"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0_02)
Java HotSpot(TM) Client VM (build 1.3.0_02, mixed mode)

One of the application that I use needs Java 1.2.2 and unfortunately
it does not work with 1.3.0_02. I have been using this application for
quite a long time. But, it stopped working imm. after I installed the
JRE 1.3.0_02.
Now, as I have 2 JRE versions in my machine, I wanted to give the Java
1.2.2 PATH first to make the Application to run.
two).
It is JRE 1.3.0_02.

After setting the Path, I just opened a new command line window from
Start->Run-Cmd.
Why should I reboot?

Thanks for your inputs!

I duplicated your path statements on my own machine
and found the following:

- When examining the path as shown at the Command Prompt
then I first get the System path, followed by the User path.
- The path is neither preceded nor suceeded by any other component.
- Programs are executed by following the path from left to right.

In considering your various posts I suggest this:
- Your path has additional elements that are not specified in
the Control Panel. Check all your startup tasks and your
registry. The component \\NTSTORE\WINRUNNER7.5\arch
is definitely not added by Windows.
- Rather than relying on Java to analyse various paths, place
a batch file JavaPath.bat of the following form into the folders
under consideration:
In C:\Program Files\JavaSoft\JRE\1.2\bin:
@echo off
echo Batch file is lcoated in C:\Program Files\JavaSoft\JRE\1.2\bin.

In C:\Program Files\JavaSoft\JRE\1.3.0_02:
@echo off
echo Batch file is lcoated in C:\Program Files\JavaSoft\JRE\1.3.0_02\bin.

Now change to the root directory of C: and execute the command
JavaPath. I expect you will see ...1.2\bin.

- Examine this registry key carefully:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\

Your machine may be due for a bit of a cleanup, to remove various
things that have accumulated over the years. I suspect some of them
are games - should they be on a machine used for programming?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top