Specify JRE/JDK when starting Apache Tomcat 7

24,652

Solution 1

A more flexible approach is to create a file named setenv.bat / setenv.sh (pick the right one for your platform) in $CATALINA_BASE/bin and set JAVA_HOME there. That way it only affects Tomcat, not anything else you are running. It also makes it easy to run multiple different Tomcat installations on different JVMs.

Solution 2

  1. Add JAVA_HOME variable to .bash_profile

  2. Add path/classpath entries

  3. Export them

e.g.

JAVA_HOME=/usr/local/java
PATH=$PATH:$JAVA_HOME/bin
CLASSPATH=$CLASSPATH:$JAVA_HOME/lib

export JAVA_HOME PATH CLASSPATH
Share:
24,652
MauroPorras
Author by

MauroPorras

Vanilla JS & Vim fan.

Updated on July 18, 2020

Comments

  • MauroPorras
    MauroPorras almost 4 years

    Is there a way to tell Tomcat 7 the path to the JVM that must be used? For example:

    startup --jvm /path/to/my/jvm