Tomcat 7: "Cannot locate Java Home"
I solved this issue following this page: https://bugs.archlinux.org/task/24126
Basically you have to add these lines in your /etc/rc.d/tomcat7 file, below the line ". /etc/conf.d/${daemon_name}"
# The JAVA_HOME of the JVM for Tomcat to use
if [ -x /usr/lib/jvm/java-6-openjdk ]; then
TOMCAT_JAVA_HOME=/usr/lib/jvm/java-6-openjdk
elif [ -x /opt/java/ ]; then
TOMCAT_JAVA_HOME=/opt/java/
fi
# Tomcat additional commandline options
CATALINA_OPTS=
Hope this helps.
Related videos on Youtube
Hugh Guiney
Hi, my name’s Hugh Guiney (🗣 GUY-knee). I’m a UX Developer, which means I design and code thoughtful digital products. I’ve worked with organizations of all sizes, from startups to SMBs to household names. In my spare time I build open-source software (check out my interactive video player, RedBlue), play fighting games, and perform improv comedy. Last name is pronounced “GUY-knee”.
Updated on September 18, 2022Comments
-
Hugh Guiney over 1 year
Arch Linux. Servlet apparently had compatibility problems with openjdk so I uninstalled it and installed the plain jdk/jre from AUR.
# /etc/rc.d/tomcat7 restart :: Stopping tomcat7 daemon [FAIL] :: Starting tomcat7 daemon [BUSY] Cannot locate Java Home
Added
export TOMCAT_JAVA_HOME=/opt/java
to/etc/profile.d/jdk.sh
(and equivalent underjdk.csh
), rebooted.echo $JAVA_HOME
andecho $TOMCAT_JAVA_HOME
both return/opt/java
, but still no dice. Why? -
Hugh Guiney over 12 yearsI was already root; no
sudo
ing involved. Tried your solution anyway though; didn't work. -
Hugh Guiney over 12 years
javac
exists, yeah. As I said I installed the JDK from AUR (community repo).which java
is/opt/java/bin/java
. No alternatives system on Arch. Anyway, Java is already in myPATH
. Haven't edited any existing variables; only added a new one (TOMCAT_JAVA_HOME
). -
Hugh Guiney over 12 yearsTried this. Didn't work.
-
djangofan over 12 years@Hugh Guiney - what happens when you try robregonm's answer? Also, when you set your var do you also export it? This shouldn't be this hard of an issue and you have given us limited information. Can you possibly post your start script or is it too long?