This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Java Interview Guide and have Anthony DePalma on-line!
See this thread for details.
The moose likes Linux / UNIX and the fly likes Setting the Env. variable in RedHat 9 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Engineering » Linux / UNIX
Bookmark "Setting the Env. variable in RedHat 9" Watch "Setting the Env. variable in RedHat 9" New topic

Setting the Env. variable in RedHat 9

Glenn Castro
Ranch Hand

Joined: Aug 24, 2003
Posts: 78
How can I setup the java home in RedHat 9?

Glenn Castro<br />Sun Certified Web Component Developer
himanshu patel
Ranch Hand

Joined: Feb 03, 2003
Posts: 205
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 ]

If you want to become a rich, do not work for others but make others to work for you.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 17423

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.

An IDE is no substitute for an Intelligent Developer.
I agree. Here's the link:
subject: Setting the Env. variable in RedHat 9
It's not a secret anymore!