How do I find what Java version Tomcat6 is using?

2019-01-22 05:25发布

Is there a OS command to find what Java version Tomcat6 is using? I need to use a Perl (including system()) command.

I using Linux. Ubuntu and CentOS

Is there something like?

     tomcat6 version

9条回答
我只想做你的唯一
2楼-- · 2019-01-22 06:07

/usr/local/tomcat6/bin/catalina.sh version

查看更多
Deceive 欺骗
3楼-- · 2019-01-22 06:10

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.

查看更多
劳资没心,怎么记你
4楼-- · 2019-01-22 06:10

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.

查看更多
姐就是有狂的资本
5楼-- · 2019-01-22 06:10

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.

查看更多
来,给爷笑一个
6楼-- · 2019-01-22 06:18

You can use the Tomcat manager app to find out which JRE and OS versions Tomcat is using. Given a user tomcat with password password with a role of manager:

Tomcat 6:

curl http://tomcat:password@localhost:8080/manager/serverinfo

Tomcat 7/8:

curl http://tomcat:password@localhost:8080/manager/text/serverinfo
查看更多
淡お忘
7楼-- · 2019-01-22 06:18

To find it from Windows OS,

  1. Open command prompt and change the directory to tomcat/tomee /bin directory.
  2. Type catalina.bat version
  3. It should print jre version details along with other informative details.

    Using CATALINA_BASE: "C:\User\software\enterprise-server-tome...

    Using CATALINA_HOME: "C:\User\software\enterprise-server-tome...

    Using CATALINA_TMPDIR: "C:\User\software\enterprise-server-tome...

    Using JRE_HOME: "C:\Program Files\Java\jdk1.8.0_25"

    Using CLASSPATH: "C:\User\software\enterprise-server-tome...

    Server version: Apache Tomcat/8.5.11

    Server built: Jan 10 2017 21:02:52 UTC

    Server number: 8.5.11.0

    OS Name: Windows 7

    OS Version: 6.1

    Architecture: amd64

    JVM Version: 1.8.0_25-b18

    JVM Vendor: Oracle Corporation

查看更多
登录 后发表回答