Enterprise systems will have different versions of Java installed in it. A system administrator may have to set up Tomcat to use a particular one out of it. By default Tomcat uses the OS default; ie. the one installed into OS path. So how can we make it run with another version of Java.
This is easily achieved using the below commands(Open a terminal and run the below commands, don’t close it.):
Run the start-up script from the same terminal and you will see from the logs that Tomcat picked up the Java from the path you set.
JRE_HOME is set to JAVA_HOME if not set. So setting any of these variables suffice.