• Welcome to Tux Reports: Where Penguins Fly. We hope you find the topics varied, interesting, and worthy of your time. Please become a member and join in the discussions.

Not able to set PATH in Windows 7

P

postvishal21

Flightless Bird
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.



Thanks and Regards,
Vishal
 
Z

Zaphod Beeblebrox

Flightless Bird
<undisclosed> wrote in message
news:6747c8d6bedb0d920dd7a96bf4c4b1b3@nntp-gateway.com...
>
> 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.

--
Zaphod

Voted "Worst Dressed Sentient Being in the Known Universe" for seven
years in a row.
 
J

Jackie

Flightless Bird
On 5/24/2010 15:32, Zaphod Beeblebrox wrote:
> 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

Flightless Bird
On Mon, 24 May 2010 09:32:48 -0400, "Zaphod Beeblebrox"
<Zaphod.Arisztid.Beeblebrox@gmail.com> wrote:

>
><undisclosed> wrote in message
>news:6747c8d6bedb0d920dd7a96bf4c4b1b3@nntp-gateway.com...
>>
>> 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.


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

Flightless Bird
"Jackie" <Jackie@an.on> wrote in message
news:4bfa98a6$0$21807$c3e8da3@news.astraweb.com...
> On 5/24/2010 15:32, Zaphod Beeblebrox wrote:
>> 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."


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...

--
Zaphod

"The best Bang since the Big One" - Eccentrica Gallumbits
 
J

Jackie

Flightless Bird
On 5/24/2010 20:19, Zaphod Beeblebrox wrote:
> 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
---
 
J

Jackie

Flightless Bird
On 5/24/2010 21:14, Jackie wrote:
> doskey cd=cd /d %1
> cd D:/


> doskey cd=cd /d D:/
> cd


You might wonder if this would cause a recursion problem but it doesn't.
Haha
 
Top