tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Millnert <>
Subject Re: Where is my Tomcat
Date Tue, 25 Jul 2006 08:56:03 GMT
On Mon, 2006-07-24 at 23:02 +0200, edward wrote:
> OOzy Pal wrote:
> >>
> >>
> >
> > I found the JKD but I am not sure how start tomcat. I am really stuck.
> > I am not sure what am I missing? Is there a good tutorial for
> > installing tomcat?
> >
> > Any help is appreciated.
> Chances are that the Debian tomcat init scripts point to gcj not to the
> Sun jdk. It's OK, you can fix that. Try javac -version, it will tell you
> about the compiler (which is part of the jdk, not the jre).  Probably
> you will find that /usr/bin/java and about half a dozen other
> /usr/bin/javax commands including javac and javah are symlinks to the
> gcj versions of java somewhere in /usr/lib. So what you need to do is to
> change those symlinks to point to the Sun ones, probably in
> /usr/share/lib. Some distros have a command which lets you change the
> system's version of java (Gentoo does, I'm not sure about Debian)
> without manually editing all the symlinks.

For reference, on a Ubuntu dapper desktop machine, here's how to manage
the symlinks:
root@desktop1:~# which java
root@desktop1:~# ls -al /usr/bin/java*
lrwxrwxrwx 1 root root 22 2006-02-02 15:29 /usr/bin/java
-> /etc/alternatives/java
lrwxrwxrwx 1 root root 23 2006-03-02 14:25 /usr/bin/javac
-> /etc/alternatives/javac
lrwxrwxrwx 1 root root 25 2006-03-02 14:25 /usr/bin/javadoc
-> /etc/alternatives/javadoc
lrwxrwxrwx 1 root root 23 2006-03-02 14:25 /usr/bin/javah
-> /etc/alternatives/javah
lrwxrwxrwx 1 root root 23 2006-03-02 14:25 /usr/bin/javap
-> /etc/alternatives/javap
lrwxrwxrwx 1 root root 24 2006-03-02 14:26 /usr/bin/javaws
-> /etc/alternatives/javaws

These commands does not have to be run as root, Ubuntu favours not using
the root account but sudo instead -- which is how OOzy was working.
The above shows and proves that the Ubuntu-style method is in fact in
use, and unorthodox methods has not been introduced to the packages. ;)
There are clear advantages of managing the JDKs as real packages, and
there is plenty of reference on this online:

Ubuntu (as well as Debian) ships with the update-alternatives program,
which manages the symlinks and it is necessary to redirect these if you
have installed and are planning on using the Sun JDK.


root@desktop1:~# update-alternatives --config java

There are 5 alternatives which provide `java'.

  Selection    Alternative
      1        /usr/lib/j2sdk1.5-sun/bin/java
*     2        /usr/lib/j2sdk1.4-sun/bin/java
      3        /usr/bin/gij-wrapper-4.1
      4        /usr/bin/gij-wrapper-4.0
 +    5        /usr/lib/jvm/java-gcj/jre/bin/java

Press enter to keep the default[*], or type selection number: 

Note that this only configures the `which java`-program. You should
point all programs to the same version. At the very least make sure
"java" and "javac" are pointing to the same JDK to avoid confusion.
To point all programs in a one-liner, you could use:
root@desktop1:~# cd /usr/bin && for PROGRAM in `ls java*`; do
update-alternatives --config $PROGRAM ; done

If you're using the sudo administration method, modify the line
root@desktop1:~# cd /usr/bin && for PROGRAM in `ls java*`; do sudo
update-alternatives --config $PROGRAM ; done

This requires you to possibly write in the password as many times as
there are PROGRAMs, unless your system cache your sudo credentials.
A more complicated method to achieve the same result is:
sudo bash -c 'cd /usr/bin && for PROGRAM in `ls java*`; do
update-alternatives --config $PROGRAM ; done'

Martin Millnert <>

View raw message