LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
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.

Notices


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

Rep: Reputation: 0
Unhappy environment variables


Hi!

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
echo $JAVA_HOME

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.

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

Thanks.
 
Old 10-05-2004, 07:37 AM   #2
michaelk
Moderator
 
Registered: Aug 2002
Posts: 26,800

Rep: Reputation: 6333Reputation: 6333Reputation: 6333Reputation: 6333Reputation: 6333Reputation: 6333Reputation: 6333Reputation: 6333Reputation: 6333Reputation: 6333Reputation: 6333
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
MunterMan
Member
 
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)

jre-latest.csh:
if ( ! $?JAVA_HOME ) then
setenv JAVA_HOME /usr/local/jdk 1.5.0/jre
setenv PATH "${PATH}:${JAVA_HOME}/bin"
endif


jre-latest.sh:
if [ -z "$JAVA_HOME" ]; then
export JAVA_HOME=/usr/local/jdk 1.5.0/jre
export PATH="$PATH:$JAVA_HOME/bin"
fi


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
Prakhardeep
LQ Newbie
 
Registered: May 2004
Distribution: RH9
Posts: 11

Original Poster
Rep: Reputation: 0
Talking

Thanks!

I got it done.
 
  


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
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

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 02:10 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