How to find the tomcat version installed| check the java version used in tomcat

Sometimes, we need to find the Tomcat version installed on the machine. version.sh or version.bat in the bin folder of the Tomcat directory provides information about the Tomcat and Java versions installed.

  • version.sh is for Linux and Unix OS.
  • version.bat is for Windows.

In this tutorial, we will explore different methods to check the installed Tomcat version.

Checking the Tomcat Version in Windows

First, navigate to the Tomcat installation directory.

In my system, it is located in the B:\apache-tomcat-9.0.35 folder. Proceed to the bin folder.

Run version.bat in the command line on Windows. For Linux machines, use version.sh.

B:\apache-tomcat-9.0.35\bin>version.bat
Using CATALINA_BASE:   "B:\apache-tomcat-9.0.35"
Using CATALINA_HOME:   "B:\apache-tomcat-9.0.35"
Using CATALINA_TMPDIR: "B:\apache-tomcat-9.0.35\temp"
Using JRE_HOME:        "A:\Java\jdk1.8.0"
Using CLASSPATH:       "B:\apache-tomcat-9.0.35\bin\bootstrap.jar;B:\apache-tomcat-9.0.35\bin\tomcat-juli.jar"
Server version: Apache Tomcat/9.0.35
Server built:   May 5 2020 20:36:20 UTC
Server number:  9.0.35.0
OS Name:        Windows 10
OS Version:     10.0
Architecture:   amd64
JVM Version:    1.8.0_102-b14
JVM Vendor:     Oracle Corporation

Finding the Tomcat Version in Linux/Unix ?

First, check the version.sh file located in the bin folder of the Tomcat directory on UNIX and Linux machines.

Use the find command to locate the version.sh file.

sudo find / -name "version.sh"

Output

/usr/local/content/Tomcat/apache-tomcat-8.5.37/bin/version.sh

Another way is to check process information using the ps command.

Use the ps command to find Tomcat process information.

ps -aef |grep -i tomcat

This provides the process ID and the path of the Tomcat installation location.

root      7128     1  0 Aug14 ?        00:06:20 /usr/local/java/j2sdk-image//bin/java -Djava.util.logging.config.file=/usr/local//Tomcat/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djdk.tls.ephemeralDHKeySize=2048 -Djava.protocol.handler.pkgs=org.apache.catalina.webresources -Xms256m -Xmx4096m -XX:MaxPermSize=4096m -XX:OnOutOfMemoryError=/usr/bin/oom-handler -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/usr/local/Tomcat/current/logs/heap-dumps -classpath /usr/local/Tomcat/current/bin/bootstrap.jar:/usr/local/Tomcat/current/bin/tomcat-juli.jar -Dcatalina.base=/usr/local/Tomcat/current -Dcatalina.home=/usr/local/Tomcat/current -Djava.io.tmpdir=/usr/local/Tomcat/current/temp org.apache.catalina.startup.Bootstrap start
user    17624 17470  0 09:21 pts/0    00:00:00 grep --color=auto -i tomcat

Checking Tomcat Running Version using the lib Folder

  • Navigate to the Tomcat root folder.

  • Go to the lib folder.

  • Run the following Java command:

    java -cp catalina.jar org.apache.catalina.util.ServerInfo

B:\apache-tomcat-9.0.35\lib>java -cp catalina.jar org.apache.catalina.util.ServerInfo
Server version: Apache Tomcat/9.0.35
Server built:   May 5 2020 20:36:20 UTC
Server number:  9.0.35.0
OS Name:        Windows 10
OS Version:     10.0
Architecture:   amd64
JVM Version:    1.8.0_102-b14
JVM Vendor:     Oracle Corporation

Checking the Tomcat Version in a JSP File

The application scope object contains server information.

In server.jsp:

<%= application.getServerInfo() %>

outputs:

Apache Tomcat/9.0.35.0

Tomcat Version Check using Release Notes

Every Tomcat version contains a RELEASE-NOTES file. You can find the file and check the version.

Using the command line, navigate to the Tomcat root directory.

In Windows:

B:\apache-tomcat-9.0.35>type RELEASE-NOTES | find "Apache Tomcat Version"
                     Apache Tomcat Version 9.0.35

In Linux, you can use the below command.

/usr/Tomcat/apache-tomcat-8.5.37$ sudo cat RELEASE-NOTES | grep "Apache Tomcat Version"
                     Apache Tomcat Version 8.5.37