I've installed Ubuntu 14.04 Server, extracted JDK1.8u5 and Tomcat7, and added the following to .profile (I also tried adding it to .bashrc with similar [non-] results):
export JAVA_HOME=/opt/java/jdk1.8.0_05 export PATH=$PATH:$JAVA_HOME/bin
when I run
echo $JAVA_HOME I get the expected result of
/opt/java/jdk1.8.0_05. I can also run
java -version and get the correct response from Java. so far so good.
so now I try to startup Tomcat (tried also catalina.sh), and I get the following:
user@ubuntu:~$ sudo /opt/tomcat7/apache-tomcat-7.0.53/bin/startup.sh 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
but... I just tried
echo $JAVA_HOME and it worked?