Shahe
Shahe

Reputation: 984

Detecting the version Tomcat Server (JSP/Servlet)

I developed an application using JSP/Servlets, it runs on tomcat server. I am using the Tomcat Manager Commands to do some stuff like (deploy/undeploy... etc.). The problem is that the tomcat manager commands differ from version 6 to 7. Anyway, my application has to detect the version of the tomcat it is running on, and according to that change the commands in the application. Any Ideas?

Upvotes: 0

Views: 389

Answers (2)

shylesh krishna
shylesh krishna

Reputation: 86

Windows:

java.exe -cp lib\catalina.jar org.apache.catalina.util.ServerInfo

Linux:

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

Upvotes: 0

Keerthivasan
Keerthivasan

Reputation: 12880

You can probably make use of getServerNumber() method in org.apache.catalina.util.ServerInfo class in catalina.jar file.

Upvotes: 2

Related Questions