LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 08-09-2003, 09:18 AM   #1
Nylex
LQ Addict
 
Registered: Jul 2003
Location: London, UK
Distribution: Slackware
Posts: 7,464

Rep: Reputation: Disabled
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.
 
Old 08-09-2003, 09:30 AM   #2
jalal
Member
 
Registered: Aug 2003
Location: .bh
Distribution: Gentoo
Posts: 188

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

or to /etc/profile for everybody
 
Old 08-09-2003, 09:30 AM   #3
Mathieu
Senior Member
 
Registered: Feb 2001
Location: Montreal, Quebec, Canada
Distribution: RedHat, Fedora, CentOS, SUSE
Posts: 1,403

Rep: Reputation: 46
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.
OR
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.

Last edited by Mathieu; 08-09-2003 at 09:37 AM.
 
Old 08-09-2003, 09:47 AM   #4
kev82
Senior Member
 
Registered: Apr 2003
Location: Lancaster, England
Distribution: Debian Etch, OS X 10.4
Posts: 1,263

Rep: Reputation: 51
dont you mean /usr/local/java/bin, not /usr/local/java?
 
Old 08-09-2003, 09:50 AM   #5
Nylex
LQ Addict
 
Registered: Jul 2003
Location: London, UK
Distribution: Slackware
Posts: 7,464

Original Poster
Rep: Reputation: Disabled
Neither .bashrc or .bash_profile exist in my /home/nick. I edited /etc/profile:

PATH="/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/usr/games:/usr/local/j2sdk1.4.2/bin"

When I do 'echo $PATH', the new directory isn't there, so I also get 'java: command not found' :/.
 
Old 08-09-2003, 09:54 AM   #6
Nylex
LQ Addict
 
Registered: Jul 2003
Location: London, UK
Distribution: Slackware
Posts: 7,464

Original Poster
Rep: Reputation: Disabled
Quote:
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 .
 
Old 08-09-2003, 09:56 AM   #7
jalal
Member
 
Registered: Aug 2003
Location: .bh
Distribution: Gentoo
Posts: 188

Rep: Reputation: 30
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 )
 
Old 08-09-2003, 10:10 AM   #8
Nylex
LQ Addict
 
Registered: Jul 2003
Location: London, UK
Distribution: Slackware
Posts: 7,464

Original Poster
Rep: Reputation: Disabled
Oh ok, sorted now. Thanx .
 
Old 08-09-2003, 10:37 AM   #9
MasterC
LQ Guru
 
Registered: Mar 2002
Location: Salt Lake City, UT - USA
Distribution: Gentoo ; LFS ; Kubuntu ; CentOS ; Raspbian
Posts: 12,613

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

Cool
 
Old 08-09-2003, 11:44 AM   #10
Nylex
LQ Addict
 
Registered: Jul 2003
Location: London, UK
Distribution: Slackware
Posts: 7,464

Original Poster
Rep: Reputation: Disabled
Heh, cool. I'll remember that next time I need to change /etc/profile. Thanx again.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Setting the path variable for Java Comp. lmellen Programming 4 12-30-2004 09:51 AM
Setting the path variable for Java Comp. lmellen Programming 1 06-27-2004 10:38 PM
$path variable ? moby Linux - Newbie 3 06-01-2004 03:18 PM
Setting Path Variable for LibXML2 Miyamoto Linux - Software 1 08-19-2003 09:00 AM
setting path variable shahrahulb Linux - General 2 07-30-2003 08:25 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 11:40 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration