How do I find what Java version Tomcat6 is using?

后端 未结 9 954
面向向阳花
面向向阳花 2020-12-13 17:40

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 the

相关标签:
9条回答
  • 2020-12-13 17:49

    After installing tomcat, you can choose "configure tomcat" by search in "search programs and files". After clicking on "configure Tomcat", you should give admin permissions and the window opens. Then click on "java" tab. There you can see the JVM and JAVA classpath.

    0 讨论(0)
  • 2020-12-13 17:49

    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

    0 讨论(0)
  • 2020-12-13 17:52

    For Windows, launch cmd prompt and route to the path(usually bin) where you have your tomcat startup script.

    C:\opt\isv\tomcat-7.0\grid\bin>version
    Using CATALINA_BASE:   "C:\opt\isv\tomcat-7.0\grid"
    Using CATALINA_HOME:   "C:\opt\isv\tomcat-7.0\grid"
    Using CATALINA_TMPDIR: "C:\opt\isv\tomcat-7.0\grid\temp"
    Using JRE_HOME:        "C:\opt\isv\devtools\jdk1.8.0_45"
    Using CLASSPATH:       "C:\opt\isv\tomcat-7.0\grid\bin\bootstrap.jar;C:\opt\isv\tomcat-7.0\grid\bin\tomcat-juli.jar"
    Server version: Apache Tomcat/7.0.55
    Server built:   Jul 18 2014 05:34:04
    Server number:  7.0.55.0
    OS Name:        Windows 7
    OS Version:     6.1
    Architecture:   x86
    JVM Version:    1.8.0_45-b15
    JVM Vendor:     Oracle Corporation
    C:\opt\isv\tomcat-7.0\grid\bin>
    
    0 讨论(0)
  • 2020-12-13 17:57

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

    0 讨论(0)
  • 2020-12-13 17:57

    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.

    0 讨论(0)
  • 2020-12-13 18:06

    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.

    0 讨论(0)
提交回复
热议问题