How to set JAVACMD
5,603
Replace JAVA_HOME in the /etc/tomcat/tomcat.conf with /usr/java/jre1.8.0_51
Related videos on Youtube
Author by
Roy Hinkley
Updated on September 18, 2022Comments
-
Roy Hinkley almost 2 years
I have a
Tomcat7
install on aCentOS (6.7)
system. Tomcat will not run, throwing exception incatalina.out
/usr/sbin/tomcat: line 29: -classpath: command not found
and related
tomcat-initd.log
/usr/sbin/tomcat: error: Failed to set JAVACMD
According to this SF post, I should be able to set it in
/usr/share/java-utils/java-functions
like this:# Add all sorts of jvm layouts here if [ -x "$JAVA_HOME/jre/sh/java" ]; then JAVACMD="$JAVA_HOME/jre/sh/java" elif [ -x "$JAVA_HOME/bin/java" ]; then JAVACMD="$JAVA_HOME/bin/java" else JAVACMD=`which java 2>/dev/null` fi if [ ! -x "$JAVACMD" ]; then echo "$0: error: Failed to set JAVACMD" return 1 fi
But I still get the exception. What's missing? What am I not understanding, and how do I resolve the exception?
JAVA_HOME is set:
echo $JAVA_HOME /usr/java/jdk1.7.0_79
Checking tomcat status:
sudo service tomcat status PID file exists, but process is not running [WARNING] tomcat lockfile exists but process is not running [FAILED]
This is true even after deleting the Tomcat pid file, rinsing and repeating.
Request responses:
whereis java java: /usr/bin/java /etc/java /usr/lib/java /usr/share/java ls -lad /usr/bin/java lrwxrwxrwx. 1 root root 21 Jul 21 2015 /usr/bin/java -> /usr/java/jre1.8.0_51 ls -lad /etc/alternatives/java lrwxrwxrwx. 1 root root 20 Jul 21 2015 /etc/alternatives/java -> /usr/java/glassfish4
after commenting out
JAVA_HOME
intomcat.conf
/etc/rc.d/init.d/tomcat start Starting tomcat: [ OK ] sudo service tomcat status tomcat (pid 13517) is running... [ OK ]
-
ALex_hha over 8 yearsCould you run 'whereis java' and show the output?
-
Roy Hinkley over 8 years@ALex_hha see edit.
-
ALex_hha over 8 yearsand 'ls -lad /usr/bin/java' and '/etc/alternatives/java'
-
Roy Hinkley over 8 years@ALex_hha updated edit
-
user9517 over 8 yearsYour JAVA_HOME does not seem to match your installed JAVA.
-
ALex_hha over 8 yearscomment JAVA_HOME in the /etc/tomcat/tomcat.conf and then run 'JAVA_HOME=/usr/java/jre1.8.0_51 bash -x /usr/sbin/tomcat version'
-
Roy Hinkley over 8 years@ALex_hha Please see pastebin.com/tYtxjwiU
-
Roy Hinkley over 8 years@ALex_hha Please move your comments to answer.
-
user9517 over 8 yearsPossible duplicate of CentOS, Tomcat 6 failed and won't start - java issue?
-