Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 10-05-2004, 07:25 AM   #1
LQ Newbie
Registered: May 2004
Distribution: RH9
Posts: 11

Rep: Reputation: 0
Unhappy environment variables


I want to khow how to permanently set environment variables in RH9.

I logged in as root and i have to set JAVA_HOME variable to its directory /usr/local/jdk1.5.0.

I used at bash prompt the command:

export JAVA_HOME= "/usr/local/jdk1.5.0"

after that i executed

then i can see the path /usr/local/jdk1.5.0

but when i close the bash and restart it, the variable is gone................

Now, if i run echo $JAVA_HOME, i get nothig.

please tell me hoe to set the variables so that they are always there.

Old 10-05-2004, 07:37 AM   #2
Registered: Aug 2002
Posts: 25,907

Rep: Reputation: 5986Reputation: 5986Reputation: 5986Reputation: 5986Reputation: 5986Reputation: 5986Reputation: 5986Reputation: 5986Reputation: 5986Reputation: 5986Reputation: 5986
If you use the export command in a term it is only valid while open.

Add the path to your users .bash_profile file
Old 10-05-2004, 09:02 AM   #3
Registered: Nov 2003
Location: The North of England
Distribution: Suse 10.3
Posts: 172

Rep: Reputation: 30
In your /etc/profile.d directory there should be two files called jre*.sh and jre*.csh.
These are executed at start up and will set the environment for your jre.
If they don't exist, they are plain text and look like this
(NOTE: one has curly brackets and endif)

if ( ! $?JAVA_HOME ) then
setenv JAVA_HOME /usr/local/jdk 1.5.0/jre
setenv PATH "${PATH}:${JAVA_HOME}/bin"
if [ -z "$JAVA_HOME" ]; then
export JAVA_HOME=/usr/local/jdk 1.5.0/jre
export PATH="$PATH:$JAVA_HOME/bin"

Make sure the path is correct. The files you are looking for are binaries called java and java_vm and should be in /usr/local/jdk 1.5.0/jre/bin
Old 10-06-2004, 03:30 AM   #4
LQ Newbie
Registered: May 2004
Distribution: RH9
Posts: 11

Original Poster
Rep: Reputation: 0


I got it done.


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
Environment Variables - where do they go!?! iansoundz Linux - General 7 11-17-2005 02:27 AM
environment variables in c++ s3b0 Programming 6 08-27-2004 09:19 AM
when to use environment variables? mark_2811 Programming 2 02-23-2004 06:09 PM
environment variables kakridge Linux - Newbie 1 07-14-2003 06:25 PM
environment variables aethereal Linux - Newbie 7 12-19-2001 09:34 AM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 10:09 AM.

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