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?
/root/.bashrcwith nano, as you suggested, but callinguser@ubuntu:~$ source /root/.bashrcresults in-bash: /root/.bashrc: Permission deniedand trying it with sudo yieldssudo: source: command not found. retrying the original command at this point brings me back to point 0. – isapir May 18 '14 at 18:05sudo -ibefore yousource. Thanks for pointing that out. – jobin May 18 '14 at 18:06sudo -ionce I'vet called source? without exiting I am getting the original error message... – isapir May 18 '14 at 18:08exit. – jobin May 18 '14 at 18:09Neither the JAVA_HOME nor the JRE_HOME environment variable is defined:s – isapir May 18 '14 at 18:10/etc/environmentand calledsource /etc/environmentbut still getting the original error message... – isapir May 18 '14 at 18:18/etc/environementvariables are also reset, you would need to usesudo suand then run the/opt/tomcat7/apache-tomcat-7.0.53/bin/startup.sh. – jobin May 18 '14 at 18:29/etc/environmentis not a script and so theexportcommand in it was causing problems. – isapir May 18 '14 at 19:10source /etc/environmentwas not enough. I had to reboot the server. thank you for your help! – isapir May 18 '14 at 19:26