Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Setting the Env. variable in RedHat 9

 
Glenn Castro
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How can I setup the java home in RedHat 9?
 
himanshu patel
Ranch Hand
Posts: 205
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think it would be better if you specify the JAVA_HOME env variable in your .bash_profile file. If you have root access, you can set it into file
/etc/bashrc so that it will be available to all users.

just make following entry into file.

export JAVA_HOME=your JDK path go here

Example. export JAVA_HOME=/usr/local/jdk1.3.1
[ June 23, 2004: Message edited by: himanshu patel ]
 
Tim Holloway
Saloon Keeper
Pie
Posts: 18012
47
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In Unix/Linux, environment variables aren't something you set globally and they apply everywhere. Most commonly you set them in one of the profile files (I prefer .bash_profile) for the account that will use them.

Also, in case you haven't been bitten yet, every time you open a new command shell and don't specify otherwise, you'll get a new environment. A lot of people get frustrated becuase they write a script that sets JAVA_HOME but after they call it, JAVA_HOME's not set, because they didn't export the value from the script's environment to the script invoker's environment.

JAVA_HOME isn't used by Java itself, but it's a very useful convention adopted by all the major Java applications. It makes it possible for different apps to run with different Java versions in the same machine.
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic