In order to get tomcat working on my ubuntu, i downloaded "apache-tomcat-8.5.4.tar.gz"-file
Next i decompressed it and moved it to an other location:
tar -xvzf apache-tomcat-8.5.4.tar.gz
sudo mkdir -p /opt/tomcat
sudo mv apache-tomcat-8.5.4 /opt/tomcat/
I also added some variables to system:
export JAVA_HOME=/usr/lib/java/jdk1.8.0_102
export CATALINA_HOME=/opt/tomcat/apache-tomcat-8.5.4
export PATH="$PATH:$JAVA_HOME/bin"
sourced it:
source .profile
When i run:
java -version
it correctly prints:
1.8.0_102 .. etc
But when i run:
sudo $CATALINA_HOME/bin/startup.sh
it fails with message:
Neither the JAVA_HOME nor the JRE_HOME environment variable is defined
At least one of these environment variable is needed to run this program
Anybody could refer to this issue?
Thanks and Greetings!
Try having this configuration inside your $CATALINA_HOME/bin/catalina.sh:
JAVA_HOME=/usr/lib/java/jdk1.8.0_102
CATALINA_HOME=/opt/tomcat/apache-tomcat-8.5.4
Put it as the first two lines of the file so it can use it later on.
Hope it helps