7

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
Can
  • 8,502
  • 48
  • 57
MauroPorras
  • 5,079
  • 5
  • 30
  • 41

2 Answers2

29

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.

icedwater
  • 4,701
  • 3
  • 35
  • 50
Mark Thomas
  • 16,339
  • 1
  • 39
  • 60
5
  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
Ahmed Ashour
  • 5,179
  • 10
  • 35
  • 56
Satya
  • 8,693
  • 5
  • 34
  • 55