I am fairly new to linux and have been facing this issue and was wondering if something can help resolve it. So when I try to shutdown Tomcat, this is the error I am getting. As you can see 'bin' is repeated in the path. I can see that its picking up the wrong path but not sure what variable needs to be modified as I checked $JAVA_HOME and $PATH, and they seem to be fine.

bash-4.1$ ./shutdown.sh
Using CATALINA_BASE:   /apps/opt/apache-tomcat-7.0.77
Using CATALINA_HOME:   /apps/opt/apache-tomcat-7.0.77
Using CATALINA_TMPDIR: /apps/opt/apache-tomcat-7.0.77/temp
Using JRE_HOME:        /usr/java/jre1.8.0_121/bin
Using CLASSPATH:       /apps/opt/apache-tomcat-7.0.77/bin/bootstrap.jar:/apps/opt/apache-tomcat-7.0.77/bin/tomcat-juli.jar
/apps/opt/apache-tomcat-7.0.77/bin/catalina.sh: line 467: /usr/java/jre1.8.0_121/bin/bin/java: No such file or directory

Also, the checked like 467 and this is what it says which I am not sure what to make. This is how it looks like:

    467   eval "\"$_RUNJAVA\"" $LOGGING_MANAGER $JAVA_OPTS \
    468     -Djava.endorsed.dirs="\"$JAVA_ENDORSED_DIRS\"" -classpath "\"$CLASSPATH\"" \
    469     -Dcatalina.base="\"$CATALINA_BASE\"" \

Also here's what PATH and JAVA_HOME look like.

bash-4.1$ echo $JAVA_HOME

bash-4.1$ echo $PATH
  • 1
    Have you tried setting $JRE_HOME to the value without bin? I don't know much about Java, but HOME perhaps sounds like it's expecting to be a sort of top-level directory, not a bin directory inside it. – Celada Apr 14 '17 at 15:01
  • 2
    The problem is where it calculates the RUNJAVA value. Can you edit your question to include this passage? – tripleee Apr 14 '17 at 15:03
  • @Celada I did use the $JRE_HOME without. Still the same issue. – user2373210 Apr 14 '17 at 15:33

It looks as if your JRE_HOME variable contains the path /usr/java/jre1.8.0_121/bin and that catalina.sh is using $JRE_HOME/bin/java as the full path to the java executable.

$JRE_HOME/bin/java will expand to /usr/java/jre1.8.0_121/bin/bin/java which can not be found.

It is likely that JRE_HOME should be set to /usr/java/jre1.8.0_121 rather than to /usr/java/jre1.8.0_121/bin.

There is an answer with a comment over at StackOverflow that confirms this, and that goes on to say that if JRE_HOME is unset, the value of JAVA_HOME will be used instead.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.