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 folder gives tomcat and java versions of the machine.
version. sh
is for Linux and Unix OS
version.bat
is for windows
In this tutorial, Different ways we can check the installed Tomcat version.
Check the tomcat version in windows?
First, go to the installed folder on tomcat home
In my System, It is located in the B:\apache-tomcat-9.0.35 folder, Go to the bin folder
Run version.bat
in the command line in windows, If you are using it on a Linux machine, you can use the 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
How to find the tomcat version in Linux/Unix?
First, Check the version.sh file located in tomcat directory bin folder in UNIX and Linux machine
We can use the find command to find the filename=version.sh.
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.
We have to find the tomcat process information using the ps command.
ps -aef |grep -i tomcat
It gives the process id and 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
Check tomcat running version using lib folder
- Go to tomcat root folder,
- cd lib folder
- Run the below 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
How to check the tomcat version in the JSP file
application scope object has server information
In server.jsp
<%= application.getServerInfo() %>
outputs:
Apache Tomcat/9.0.35.0
Tomcat version check using release notes
Every version of tomcat contains a RELEASE-NOTES file, You can check the file by opening the file.
With the command line, you can run the below commands from 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