setting the JAVA_HOME environment variable
Thufir
hawat.thufir at gmail.com
Mon Mar 24 07:52:51 UTC 2008
what's the correct way to set the JAVA_HOME environment variable?
What I did was to add an entry to .bashrc for a specific profile. Surely
there's a better way? This is only effective for one user and is fragile
-- once Java 7 is installed the .bashrc is out of date and must be
manually updated.
Perhaps I'm not installing packages correctly? I'd just as soon
uninstall all non-Sun java's (gcj and so forth).
I'm setting this variable to use the
http://incubator.apache.org/buildr/ ruby replacement for ant.
Here's what I have with the environment variable:
thufir at arrakis:~$ echo $JAVA_HOME
/usr/lib/jvm/java-6-sun/jre/bin/java
thufir at arrakis:~$
thufir at arrakis:~$ whereis javac
javac: /usr/bin/javac /usr/share/man/man1/javac.1.gz
thufir at arrakis:~$
thufir at arrakis:~$ ll /usr/bin/javac
lrwxrwxrwx 1 root root 23 2008-03-19 02:39 /usr/bin/javac -> /etc/
alternatives/javac
thufir at arrakis:~$
thufir at arrakis:~$ java -version
java version "1.6.0_03"
Java(TM) SE Runtime Environment (build 1.6.0_03-b05)
Java HotSpot(TM) Client VM (build 1.6.0_03-b05, mixed mode, sharing)
thufir at arrakis:~$
thufir at arrakis:~$ sudo update-alternatives --config java
There are 2 alternatives which provide `java'.
Selection Alternative
-----------------------------------------------
1 /usr/bin/gij-4.2
*+ 2 /usr/lib/jvm/java-6-sun/jre/bin/java
Press enter to keep the default[*], or type selection number: 2
Using `/usr/lib/jvm/java-6-sun/jre/bin/java' to provide `java'.
thufir at arrakis:~$
thufir at arrakis:~$ cat -n .bashrc | head -n 16 | tail -n 4
13
14 JAVA_HOME="/usr/lib/jvm/java-6-sun/jre/bin/java"
15 export JAVA_HOME
16
thufir at arrakis:~$
thanks,
Thufir
More information about the ubuntu-users
mailing list