Tomcat 5.5: no JDK found

If you install Tomcat 5.5 (or 5.0) in Ubuntu, you may see Tomcat failing to start because JAVA_HOME is not set:

giannis@giannis-desktop:~$ sudo /etc/init.d/tomcat5.5 start
[sudo] password for giannis:
* no JDK found - please set JAVA_HOME
giannis@giannis-desktop:~$

One way to quickly solve this problem is to edit the file /etc/default/tomcat5.5:

sudo gedit /etc/default/tomcat5.5

Find the section where the JAVA_HOME variable is defined. It should look like this:

# The home directory of the Java development kit (JDK). You need at least
# JDK version 1.4. If JAVA_HOME is not set, some common directories for
# the Sun JDK, various J2SE 1.4 versions, and the free runtimes
# java-gcj-compat-dev and kaffe are tried.
#JAVA_HOME=/usr/lib/jvm/java-6-sun

Uncomment the line that sets the JAVA_HOME variable, and if necessary provide the java runtime environment of your preference. After editing it should look like this one:

# The home directory of the Java development kit (JDK). You need at least
# JDK version 1.4. If JAVA_HOME is not set, some common directories for
# the Sun JDK, various J2SE 1.4 versions, and the free runtimes
# java-gcj-compat-dev and kaffe are tried.
JAVA_HOME=/usr/lib/jvm/java-6-sun

Save the file and try again to start Tomcat, it should be able to start now:

giannis@giannis-desktop:~$ sudo /etc/init.d/tomcat5.5 start
* Starting Tomcat servlet engine tomcat5.5 [ OK ]
giannis@giannis-desktop:~$

This entry was posted in Uncategorized. Bookmark the permalink.

4 Responses to Tomcat 5.5: no JDK found

  1. bob says:

    no one likes a smart arse.. so many thanks for this 🙂

  2. saygley says:

    worked like britney spears, thx!

  3. Schmigz says:

    Thank you. Good solution instead of setting it in a non-default location. Also, possible the best comments every below this…

  4. In the Year 2011 it doesn`t work! 🙁

Leave a Reply

Your email address will not be published. Required fields are marked *