Not able to set PATH in Windows 7

U

undisclosed

Hi,
I have an installed JDK on my Windows 7. I have to set PATH variable
%JAVA_HOME% .
I am trying to do that as follows :

Control Panel -> System and Security -> System -> Remote Settings ->
System Properties -> Advanced -> Environment Variables .

In the Environment Variables Window I am trying to add PATH Variable
for both 'User Variables' and 'System Variables'

I am providing Variable name and its value as follows :
Edit ->
Variable Name : JAVA_HOME
Variable Value : D:\Program Files\Java\jdk1.6.0_20\bin

Press OK and then close all the Windows .

Start cmd windows to see if you can test the new PATH Variable.

C:\Users\Vishal>
C:\Users\Vishal>cd %JAVA_HOME%

C:\Users\Vishal>

This shows that the PATH Variable %JAVA_HOME% is not set correctly.

On the other hand if you want to verify for pre-existing PATH
Variables for example %TMP% , it works

C:\Users\Vishal>cd %TMP%

C:\Users\Vishal\AppData\Local\Temp>
C:\Users\Vishal\AppData\Local\Temp>

Let me know if any one has seen this issue earlier and if he/she know

the solution.

BTW Same set of steps work fine on a Windows XP Machine.


Thanks and Regards
Visha
 
Z

Zaphod Beeblebrox

Hi,
I have an installed JDK on my Windows 7. I have to set PATH
variable
%JAVA_HOME% .
I am trying to do that as follows :

Control Panel -> System and Security -> System -> Remote
Settings ->
System Properties -> Advanced -> Environment Variables .


In the Environment Variables Window I am trying to add PATH
Variable
for both 'User Variables' and 'System Variables'


I am providing Variable name and its value as follows :
Edit ->
Variable Name : JAVA_HOME
Variable Value : D:\Program Files\Java\jdk1.6.0_20\bin

Press OK and then close all the Windows .

Start cmd windows to see if you can test the new PATH Variable.

C:\Users\Vishal>
C:\Users\Vishal>cd %JAVA_HOME%

C:\Users\Vishal>


This shows that the PATH Variable %JAVA_HOME% is not set correctly.

On the other hand if you want to verify for pre-existing PATH
Variables for example %TMP% , it works


C:\Users\Vishal>cd %TMP%

C:\Users\Vishal\AppData\Local\Temp>
C:\Users\Vishal\AppData\Local\Temp>

Let me know if any one has seen this issue earlier and if he/she
knows

the solution.


BTW Same set of steps work fine on a Windows XP Machine.
I'll bet it is getting set correctly - you can test this by using the
command 'set JAVA_HOME'. The problem is that the 'cd' command won't
change to a different drive letter, you'll have to do that yourself
either before or after issuing the 'cd %JAVA_HOME%' command. That's
one of the disadvantages of moving Program Files to another drive
letter.
 
J

Jackie

I'll bet it is getting set correctly - you can test this by using the
command 'set JAVA_HOME'. The problem is that the 'cd' command won't
change to a different drive letter, you'll have to do that yourself
either before or after issuing the 'cd %JAVA_HOME%' command. That's
one of the disadvantages of moving Program Files to another drive
letter.
I don't know the problem but I just want to say that there's no problem
with using the "cd" command and get it to change the drive letter as
well. Try "help cd" and you'll see:

"Use the /D switch to change current drive in addition to changing
current directory for a drive."
 
C

Char Jackson

I'll bet it is getting set correctly - you can test this by using the
command 'set JAVA_HOME'. The problem is that the 'cd' command won't
change to a different drive letter, you'll have to do that yourself
either before or after issuing the 'cd %JAVA_HOME%' command. That's
one of the disadvantages of moving Program Files to another drive
letter.
Also, in the CMD window, typing 'set' with no arguments prints all of
the environment variables, so you'd be able to see if it was set
correctly.
 
Z

Zaphod Beeblebrox

Jackie said:
I don't know the problem but I just want to say that there's no
problem with using the "cd" command and get it to change the drive
letter as well. Try "help cd" and you'll see:

"Use the /D switch to change current drive in addition to changing
current directory for a drive."
I had forgotten about the /D parameter for the 'cd' command, thanks.
The OP would still have to remember to use it when necessary. Too bad
there isn't a way to make that the default behavior - although I
suppose you could use DOSKEY to create a macro like 'doskey cdd=cd
/D', but you'd have to use cdd instead of cd, and you'd have to load
the macro at each startup of the command prompt...
 
J

Jackie

I had forgotten about the /D parameter for the 'cd' command, thanks.
The OP would still have to remember to use it when necessary. Too bad
there isn't a way to make that the default behavior - although I
suppose you could use DOSKEY to create a macro like 'doskey cdd=cd
/D', but you'd have to use cdd instead of cd, and you'd have to load
the macro at each startup of the command prompt...
Ooh, doskey seems.. Wait.. Seemed to be handy. :( Didn't know about it
so thanks for making me aware of it!
Gave it some testing and it appears like you can't use it in a batch
script. :(
I tried this:
---
doskey cd=cd /d %1
cd D:\ <- The system cannot find the path specified
---

Apparently, it doesn't work like that. This works, however:
---
doskey cd=cd /d D:\
cd
---

I guess that leaves few options left but I can think of two things:
---
set setcd=cd /d

C:
%setcd% D:\
cd <-- yup, it's in D:\
---

and..
---
C:
call :setcd D:\
cd <- we're in D:\

goto :eof

:setcd
cd /d %1
goto :eof
---
 

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