which java version does tomcat use

◇◆丶佛笑我妖孽 提交于 2019-11-29 13:50:14

You can look up the Java version Tomcat is really running with in the manager app, which is installed by default. Go to http://hostname:8080/manager/html (replace hostname by hostname or localhost), scroll to the bottom, there you will find "JVM Version".

Which JVM is selected depends a lot on the OS and way to install, maybe http://tomcat.apache.org/tomcat-7.0-doc/setup.html will help.

E.g. if you are running Windows with Tomcat with the service wrapper (I would recommend this for Windows), you can set the path to the JVM directly in the tray icon -> Configure Tomcat. In the Java tab e.g. set Java Virtual Machine to "D:\java\jdk1.6.0_35\jre\bin\server\jvm.dll" (disabled "use default") or where your JVM resides -> you need to specify the complete path to the jvm.dll.

Regarding getting to know which Java the system is running on: That's difficult to answer, there isn't really one Java version that the system is running as such. E.g. for Windows there may be one Java version set in the PATH, a potentially different one in JAVA_HOME / JRE_HOME / ..., one (or more) set in the registry, a certain version plugin active in each web browser used for applets etc. You have to check in the part you are interested in. Most good Java apps will display the version used somewhere, in logs, about dialogs or so. For Firefox you can check in the add-ons / plug-ins list. A Java exe wrapper like JSmooth can search for Java in different places and choose the most suitable, e.g. the newest, not necessarily the most "exposed".

If you don't have the manager application on your server (I didn't), then you can check it like this:

ps -ef | grep tomcat

The output should list your running server:

tomcat     741     1 87 01:07 ?        00:01:15 /usr/java/default/bin/../bin/java ...

Now you know where your java is that your tomcat was executed from you can check the version like:

/usr/java/default/bin/../bin/java -version

You can choose by altering catalina.bat/catalina.sh, your set up will use JAVA_HOME, unless you change setenv.bat.

just type java -version into your dos prompt to see your default java version, which programs will use unless you explicity tell them not to.

I found this command helpful. From your tomcat install directory.

Linux

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

Window

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

Sample output

Server version: SpringSource tc Runtime/2.0.4.RELEASE
Server built: August 3 2010 0710
Server number: 6.0.28.29
OS Name: Linux
OS Version: 2.6.18-194.11.1.el5
Architecture: i386
JVM Version: 1.6.0_21-b06
JVM Vendor: Sun Microsystems Inc.

Reference at https://confluence.atlassian.com/confkb/how-to-determine-your-version-of-tomcat-and-java-331914173.html

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!