LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 05-15-2008, 04:52 AM   #1
JimOrJoe
LQ Newbie
 
Registered: Dec 2007
Posts: 24

Rep: Reputation: 15
Could not set enviroment variable properly


Hi, you:
I tried to set the environment variables on linux so I can develope java applications. However, after I appended /JDK/bin at the end of the $PATH variable and exported it, the basic shell commands like ls and cd went missing. I was careful enough to delimited the paths with ':'.
I know the subsequent paths rely on the preceding ones in the $PATH variable. Is there any recommended location in the $PATH where I should put JDK/bin?
Thanks and Best Regards
JimOrJoe

Last edited by JimOrJoe; 05-15-2008 at 04:54 AM.
 
Old 05-15-2008, 07:40 AM   #2
blackhole54
Senior Member
 
Registered: Mar 2006
Posts: 1,896

Rep: Reputation: 61
Quote:
Originally Posted by JimOrJoe View Post
However, after I appended /JDK/bin at the end of the $PATH variable and exported it, the basic shell commands like ls and cd went missing.
cd is a shell "built-in" and doesn't depend on $PATH. If it stops working, something very strange is going on. ls is in /bin; unless you give the full pathname, the shell requires /bin to be in $PATH. My guess is you just made a typo. To append:

Code:
PATH=$PATH:/JDK/bin
If at any point you want to review the value of $PATH (say to check for typos):

Code:
echo $PATH
Adding one or more elements onto the end of $PATH shouldn't cause commands that were working to stop working.
 
Old 05-15-2008, 12:38 PM   #3
Cyhaxor
Member
 
Registered: Nov 2004
Location: UK
Distribution: Fedora 12
Posts: 129

Rep: Reputation: 15
also as
Code:
export PATH
in order to permanently change your path
 
Old 05-15-2008, 10:13 PM   #4
JimOrJoe
LQ Newbie
 
Registered: Dec 2007
Posts: 24

Original Poster
Rep: Reputation: 15
Hi, Buddies up stairs:
Just so you know, I had this issue taken care of.
Strange as it is, it worked only if I ran the commands like this:
export JAVA_HOME=jdk path
export PATH=$PATH:$JAVA_HOME/bin
Thanks
JimOrJoe
 
Old 05-15-2008, 10:19 PM   #5
eggixyz
Member
 
Registered: Apr 2008
Posts: 310

Rep: Reputation: 30
Cool,

Sounds like the first you might have exported

PATH=$JAVA_HOME/bin:PATH

instead of

PATH=$JAVA_HOME/bin:$PATH

I've done it before, too. At those times, it's good to know the absolute path to all the commands you need to reset it

, Mike
 
Old 05-16-2008, 02:42 AM   #6
blackhole54
Senior Member
 
Registered: Mar 2006
Posts: 1,896

Rep: Reputation: 61
Quote:
Originally Posted by Cyhaxor View Post
also as
Code:
export PATH
in order to permanently change your path
This is kind of an esoteric point, but my experience has been that when you change what is already an environmental variable, you don't need to to export it again. And just so there is no misunderstanding about your word "permanently," changes to environmental variables only propogate to descendants of the process where they are changed. If you want the change to be permanent you need to add it to /etc/profile, ~/.bash_profile or some such so that it is executed every time you log in.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
The XAPPLRESDIR enviroment variable. SeanW Programming 3 05-02-2008 03:31 AM
Enviroment Variable for all users? thuanpv Fedora 1 07-20-2006 12:10 AM
how do I set a system wide enviroment variable? (not just bash) drkstr Linux - Newbie 11 04-19-2006 10:09 AM
enviroment variable PATH Moataz Linux - Newbie 2 04-25-2005 09:25 PM
Enviroment variable set for all ChimpFace9000 Slackware 5 12-09-2002 10:39 AM


All times are GMT -5. The time now is 10:22 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration