A more flexible approach is to create a file called setenv.bat
/ setenv.sh
(select the correct one for your platform) in $CATALINA_BASE/bin
and set JAVA_HOME
there. This way it only affects Tomcat, not something else that you use. It also makes it easy to run several different Tomcat installations on different JVMs.
source share