-   Linux - General (
-   -   Help setting $PATH variable (

Nylex 08-09-2003 09:18 AM

Help setting $PATH variable
Ok, I've just downloaded and installed the Java 2 SDK and did 'export PATH=$PATH:/usr/local/java' (without the quotes of course). The problem is that whenever I close the term, it unsets and goes back to the default. Any ideas? Thanx.

jalal 08-09-2003 09:30 AM

add it to the user's .bashrc and/or .bash_profile for a single user

or to /etc/profile for everybody

Mathieu 08-09-2003 09:30 AM

You can append to the PATH variable by adding to your new path to the .bash_profile
.bash_profile is the login script for a user and it is located in the HOME directory of each user.
You can set system wide variables and startup programs by adding to the /etc/profile

I posted at the same time as jalal,
mental note... next time... type faster. :D

kev82 08-09-2003 09:47 AM

dont you mean /usr/local/java/bin, not /usr/local/java?

Nylex 08-09-2003 09:50 AM

Neither .bashrc or .bash_profile exist in my /home/nick. I edited /etc/profile:


When I do 'echo $PATH', the new directory isn't there, so I also get 'java: command not found' :/.

Nylex 08-09-2003 09:54 AM


Originally posted by kev82
dont you mean /usr/local/java/bin, not /usr/local/java?
No, actually I meant /usr/local/j2sdk1.4.2/bin :).

jalal 08-09-2003 09:56 AM

they don't have to. just create a .bashrc/.bash_profile in your ~ dir and restart the term (if under X).

for /etc/profile, it didn't do anything because it was read when the system was booted. it will take effect next time you boot (hopefully :))

Nylex 08-09-2003 10:10 AM

Oh ok, sorted now. Thanx :).

MasterC 08-09-2003 10:37 AM

To save yourself a reboot (after all, this is linux ;) ) you can just:
source /etc/profile


Nylex 08-09-2003 11:44 AM

Heh, cool. I'll remember that next time I need to change /etc/profile. Thanx again.

All times are GMT -5. The time now is 06:07 AM.