A basic linux question: what are JAVA_HOME, ANT_HOME for?

December 07th, 2011 - 09:43 am ET by www | Report spam
Hi:

Honestly, I have been using Linux for many years. I am unclear about
some basic stuff. In the .bashrc file when using bash shell,
or .profile when using k shell, I always set JAVA_HOME, ANT_HOME etc,
following other people. But, what these are for?

Suppose I have two version of Java on my Linux:

/a/b/c/java_1.6/
/a/b/c/java_1.7/

If
export JAVA_HOME=/a/b/c/java_1.6/

Does that mean, the two commands "javac" & "java" will be:
/a/b/c/java_1.6/bin/javac
/a/b/c/java_1.6/bin/java

Can you help me understand these tokens or point me to some materials?
Thank you very much.
email Follow the discussionReplies 6 repliesReplies Make a reply

Replies

#1 Rui Maciel
December 07th, 2011 - 10:07 am ET | Report spam
www wrote:

Hi:

Honestly, I have been using Linux for many years. I am unclear about
some basic stuff. In the .bashrc file when using bash shell,
or .profile when using k shell, I always set JAVA_HOME, ANT_HOME etc,
following other people. But, what these are for?

Suppose I have two version of Java on my Linux:

/a/b/c/java_1.6/
/a/b/c/java_1.7/

If
export JAVA_HOME=/a/b/c/java_1.6/

Does that mean, the two commands "javac" & "java" will be:
/a/b/c/java_1.6/bin/javac
/a/b/c/java_1.6/bin/java

Can you help me understand these tokens or point me to some materials?
Thank you very much.



Technically, this isn't a linux question per se but a Java question. The
people behind Java decided to rely on a set of environment variables to
configure how it should run, and the JAVA_HOME environment variable happens
to be one of those environment variables. This approach was also taken in
Windows.

If I'm not mistaken, the JAVA_HOME environment variable is used to specify
the location of your system's Java executable. So, it appears you are
correct. Still, maybe it's a good idea to post this question in a more
java-centric newsgroup than this. Browsing through Oracle's site can also
be of some use.


Hope this helps,
Rui Maciel

Similar topics