How I should fix java-path, in order to run tomcat?

I think you should point your JRE_HOME to the directory where your java is installed, not the executable java itself. An example would be /usr/lib/jvm/java-7-oracle where that folder will contain the bin/java executable...


When the tomcat is started it is searching for setenv.sh in Catalina home or base.

Quote from Catalina.sh:

#   Do not set the variables in this script. Instead put them into a script
#   setenv.sh in CATALINA_BASE/bin to keep your customizations separate.

#
#   JAVA_HOME       Must point at your Java Development Kit installation.
#                   Required to run the with the "debug" argument.

# Ensure that any user defined CLASSPATH variables are not used on startup,
# but allow them to be specified in setenv.sh, in rare case when it is needed.
CLASSPATH=

if [ -r "$CATALINA_BASE/bin/setenv.sh" ]; then
  . "$CATALINA_BASE/bin/setenv.sh"
elif [ -r "$CATALINA_HOME/bin/setenv.sh" ]; then
  . "$CATALINA_HOME/bin/setenv.sh"
fi

So best way to set JAVA_HOME in tomcat is through setenv.sh

  1. create a file setenv.sh in $CATALINA_HOME folder
  2. Add this line to it : "export JAVA_HOME=/usr/"
  3. Make it executable : "chmod 750 setenv.sh"

Start the startup.sh script, it will start the tomcat.


You can also edit the file ../bin/setclasspath.sh and have an entry

JAVA_HOME="##path of the java directory##"

This will make sure whenever you try to start the tomcat, the JAVA_HOME will be enforced.