Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How do I Change the Path Variable and Get the Command Prompt to Coordinate Afterwards

 
Benjamin Chau
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When I change the environmental variable to create a new user name and variable, thus creating a new path variable that points to my Java compiler, I still can't get the Command Prompt to change to the new path variable.

I'm running XP Media Center version and everything seems to be installed correctly as far as Java (j2se 1.5.0 version 6) goes. Any help would be greatly appreciated. Thanks!
 
Martijn Verburg
author
Bartender
Posts: 3275
5
Eclipse IDE Java Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there and welcome to Javaranch!

How are you changing the PATH? If you are doing it outside of the command prompt (e.g. In My Computer --> Advanced --> Environment Variables) then you need to open up a new command prompt for that to take effect.

Hope that helps!
 
Campbell Ritchie
Sheriff
Posts: 48402
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is more about the PATH in the "common problems" page. You don't have to set the CLASSPATH. If you follow the links it says permanent setting is "optional." Forget about "optional" and set it anyway.
 
Benjamin Chau
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Martijn Verburg:
Hi there and welcome to Javaranch!

How are you changing the PATH? If you are doing it outside of the command prompt (e.g. In My Computer --> Advanced --> Environment Variables) then you need to open up a new command prompt for that to take effect.

Hope that helps!


Hi Martijn! Thanks for the welcome. This is a pretty neat online community for Java people. I still can't get it to work even though I tried your suggestion of closing the Command Prompt and reopening it.

Maybe there's a way to change the path variable also when I open up my Java software (NetBeans IDE 5.0)...
 
Campbell Ritchie
Sheriff
Posts: 48402
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, you can set the PATH temporarily for the lifetime of that window. On Linux you write something like

export PATH = /usr/java/jdk1.6.0_07/bin/:$PATH

and on Windows you have to do a search and you find this post where somebody tells how to do it.
 
Benjamin Chau
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Campbell Ritchie:
Yes, you can set the PATH temporarily for the lifetime of that window. On Linux you write something like

export PATH = /usr/java/jdk1.6.0_07/bin/:$PATH

and on Windows you have to do a search and you find this post where somebody tells how to do it.


Hi Campbell. Thanks for your great help! I still didn't get it to work despite everything I tried from reading the posts. Here's the command I issued with the relevant path location of where I installed Java on my computer.

set PATH=C:\Documents and Settings\Benjamin Q. Chau\Desktop\j2sdk-1_4_2_13-nb-5_0-win-ml\bin;%PATH%

Oh well, hoping for a breakthrough soon...
 
Benjamin Chau
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Campbell Ritchie:
Yes, you can set the PATH temporarily for the lifetime of that window. On Linux you write something like

export PATH = /usr/java/jdk1.6.0_07/bin/:$PATH

and on Windows you have to do a search and you find this post where somebody tells how to do it.


No wait a minute, shouldn't I set the path variable to point to where I have NetBeans IDE 5.0 installed, since that's the Java environment where my code is executing???
 
Campbell Ritchie
Sheriff
Posts: 48402
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, you set the PATH to include wherever you installed Java.

And if you are a raw beginner, you are probably better off using a text editor (not Notepad, try googling for Notepad++ and Notepad2 which are better for programming), instead of an IDE like NetBeans.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic