I am trying to change the JVM running on Tomcat7 on my Ubuntu 14.04 that is currently running on 1.7.0_121-b00. I currently have 1.8.0_121 version and I would like to use it in the Tomcat7. I have changed the configuration in /etc/default/tomcat7 as follow:

# Run Tomcat as this user ID. Not setting this or leaving it blank will use the
# default of tomcat7.

# Run Tomcat as this group ID. Not setting this or leaving it blank will use
# the default of tomcat7.

# The home directory of the Java development kit (JDK). You need at least
# JDK version 1.5. If JAVA_HOME is not set, some common directories for
# OpenJDK, the Sun JDK, and various J2SE 1.5 versions are tried.
JAVA_HOME= /usr/lib/jvm/java-8-oracle

But when I restart Tomcat7 it gave me the following error

/etc/default/tomcat7: /usr/lib/jvm/java-8-oracle: Permission denied

although I already am a root in this case. Is there something wrong with it?


CATALINA_HOME is path where tomcat is installed. JAVA_HOME is path to your jdk. For changing the jdk to be used by tomcat you must add the below 2 lines to the bashrc file using editor like 'nano'

$nano ~/.bashrc

In the bashrc file append the below 2 statements:

export JAVA_HOME=/path/to/your/jdk

export CATALINA_HOME=/path/to/your/tomcat

Save and exit out of .bashrc.Changes are effective after restarting the bashrc file.

$source ~/.bashrc

Once we are done with path it’s time to run tomcat And check by typing http://localhost:8080 You must see a tomcat default welcome page.

  • is the CATALINA_HOME will be /usr/share/tomcat7? – Ihsan Haikal Mar 13 '17 at 10:02
  • I don't know into which folder you have installed tomcat. I installed it in /usr/local/tomcat – rohith Mar 13 '17 at 10:04

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.