Fedora Linux Support Community & Resources Center
  #1  
Old 3rd May 2011, 06:48 PM
vefoda Offline
Registered User
 
Join Date: Mar 2011
Posts: 51
linuxfedorafirefox
Question How to set environment variables permenently?

How to set JAVA_HOME environment variables permanently such that it will not have to be set each time it has to be used
Reply With Quote
  #2  
Old 3rd May 2011, 06:53 PM
marko Offline
Registered User
 
Join Date: Jun 2004
Location: Laurel, MD USA
Posts: 6,062
linuxfirefox
Re: How to set environment variables permenently?

Quote:
Originally Posted by vefoda View Post
How to set JAVA_HOME environment variables permanently such that it will not have to be set each time it has to be used
In your home directory, edit .bashrc to add this line

Quote:
export JAVA_HOME=/usr/java/latest
or substitute whatever your JAVA_HOME is where I put /usr/java/latest.

Any future bash shell launched will have that JAVA_HOME
Reply With Quote
  #3  
Old 3rd May 2011, 07:02 PM
vefoda Offline
Registered User
 
Join Date: Mar 2011
Posts: 51
linuxfedorafirefox
Re: How to set environment variables permenently?

How to edit .bashrc to add the line
Quote:
export JAVA_HOME=/usr/java/latest
Reply With Quote
  #4  
Old 3rd May 2011, 11:02 PM
bodhi.zazen Offline
Registered User
 
Join Date: Jul 2006
Location: Montana
Posts: 731
unknownunknown
Re: How to set environment variables permenently?

Quote:
Originally Posted by vefoda View Post
How to edit .bashrc to add the line
You can also add that to .bash_profile (might be a better choice).

Use any editor and add that line at the bottom.

Code:
gedit ~/.bashrc
you can use nano, vim, emacs ....
__________________
If it is not broken, tweak it... If you break Fedora you get to keep both pieces :p
Reply With Quote
  #5  
Old 6th May 2011, 10:21 AM
Les62 Offline
Registered User
 
Join Date: Nov 2010
Posts: 4
linuxfedorafirefox
Re: How to set environment variables permenently?

Rather than putting it in your home directory .bashrc, I would put it into /etc/bashrc That way the variable will be available for all users (root included).
Reply With Quote
  #6  
Old 6th May 2011, 10:42 AM
marriedto51 Offline
Registered User
 
Join Date: Jul 2009
Location: England, UK
Posts: 912
linuxfedorafirefox
Re: How to set environment variables permenently?

Quote:
Originally Posted by Les62 View Post
Rather than putting it in your home directory .bashrc, I would put it into /etc/bashrc That way the variable will be available for all users (root included).
I believe the "approved" way of doing this for the whole system is to create a new file in /etc/profile.d/ rather than editing /etc/bashrc directly. (If you edit /etc/bashrc and bash is updated, you might get your edits overwritten, or you might not get the file updated.)

So: run
Code:
su -c 'gedit /etc/profile.d/my-java-environment.sh'
enter the line listed above by vefonda, save and exit.

Changes to your own profile or the system profile will only affect new shells, so to see the effect you can just close the current terminal window, and open a new one (or log out and in again).
Reply With Quote
Reply

Tags
environment variables, java_home, permanently

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
how to set environment variables? Seedrick Using Fedora 3 23rd May 2010 01:47 PM
Environment Variables nightmarcus Using Fedora 5 20th January 2009 11:31 AM
Environment Variables Curtor Using Fedora 4 14th February 2008 08:01 PM
environment variables? hari_mj23 Using Fedora 9 3rd April 2006 07:03 AM
Environment variables Flatron Using Fedora 7 28th January 2006 02:47 AM


Current GMT-time: 01:38 (Thursday, 23-10-2014)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive
logo

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat
Shakiso Instagram Photos - Damnagar - Wesley Chapel Travel Photos