Tomcat 10.1. x will require Java versions 11 and higher, and will use Servlet 6.0, JSP 3.1, EL 5.0, and JWS 2.1.
Tomcat 8.5 was designed to run on Java 7 or later.
Java 8 required Apache Tomcat 9.0. x requires Java 8 or later.
Tomcat 9.0. 14 on Java 11.0.
/usr/local/tomcat6/bin/catalina.sh version
At first you need to understand first, that Tomcat is a Java application. So, to see which java version Tomcat is using, you can just simply find the script file from which Tomcat is started, usually catalina.sh.
Inside this file, you will get something like below:
catalina.sh:# JAVA_HOME Must point at your Java Development Kit installation.
catalina.sh:# Defaults to JAVA_HOME if empty.
catalina.sh: [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
catalina.sh: JAVA_HOME=`cygpath --absolute --windows "$JAVA_HOME"`
catalina.sh: echo "Using JAVA_HOME: $JAVA_HOME"
By default, JAVA_HOME should be empty, which mean it will use the default version of java, or you can test with: echo $JAVA_HOME
And then use "java -version" to see which version you default java is.
And vice versa by setting this property: JAVA_HOME, you can configure which Java version to use when starting Tomcat.
Once you have started tomcat simply run the following command at a terminal prompt:
ps -ef | grep tomcat
This will show the process details and indicate which JVM (by folder location) is running tomcat.
If tomcat did not start up yet , you can use the command \bin\cataline version
to check which JVM will the tomcat use when you start tomcat using bin\startup
In fact ,\bin\cataline version
just call the main class of org.apache.catalina.util.ServerInfo
, which is located inside the \lib\catalina.jar
. The org.apache.catalina.util.ServerInfo
gets the JVM Version and JVM Vendor by the following commands:
System.out.println("JVM Version: " +System.getProperty("java.runtime.version"));
System.out.println("JVM Vendor: " +System.getProperty("java.vm.vendor"));
So , if the tomcat is running , you can create a JSP page that call org.apache.catalina.util.ServerInfo
or just simply call the above System.getProperty()
to get the JVM Version and Vendor . Deploy this JSP to the running tomcat instance and browse to it to see the result.
Alternatively, you should know which port is the running tomcat instance using . So , you can use the OS command to find which process is listening to this port. For example in the window , you can use the command netstat -aon
to find out the process ID of a process that is listening to a particular port . Then go to the window task manager to check the full file path of this process ID belongs to. .The java version can then be determined from that file path.
Or you could use the Probe application and just look at its System Info page. Much easier than writing code, and once you start using it you'll never go back to Tomcat Manager.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With