JAVA_HOME defined but maven2 compains it could not find it

Alan Pope alan at
Fri Oct 22 14:34:12 UTC 2010

On 22 October 2010 15:15, Tapas Mishra <mightydreams at> wrote:
> Ok I read the link you gave and also man page of update-alternatives
> excerpts from your link
> "update-alternatives --config java"
> I could not understand how to do so.
> My usual way to do so would be to add $JAVA_HOME before /usr/bin in
> $PATH in /etc/profile
> but I feel there should be an elegant way to do so.
> I have created a symbolic link so now
> ls -l /usr/bin/java
> lrwxrwxrwx 1 root root 41 2010-10-20 16:36 /usr/bin/java ->
> /usr/lib/jvm/java-6-sun-
> is this correct.

I don't think you needed to update anything. /usr/bin/java points to
/etc/alternatives/java which (probably) points to
/usr/lib/jvm/java-6-sun-, if it doesn't then you
follow the steps. E.g.

First list the java packages installed..
alan at hactar:~$ sudo update-java-alternatives -l
java-6-openjdk 1061 /usr/lib/jvm/java-6-openjdk

(I only have one)

Then point java alternatives to it.
alan at hactar:~$ sudo update-java-alternatives -s java-6-openjdk

Doing a direct link from /usr/bin/java to somewhere will work, but
possibly break when a different version of java is installed later.


More information about the ubuntu-users mailing list