Freakyuser
Freakyuser

Reputation: 2814

which java version does tomcat use

I have set the JAVA_HOME to C:\Program Files\Java\jdk1.5.0_11
I have set the Classpath to C:\Program Files\Java\jre1.5.0_11

I have set the path to

C:\Ruby193\bin;C:\XEClient\bin; F:\oracle\product\10.2.0\db_2\bin;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem; C:\Program Files\Java\jdk1.6.0_17\bin; C:\Program Files\jEdit;C:\Program Files\TortoiseSVN\bin; C:\Program Files\Microsoft SQL Server\90\Tools\binn\

Now my question is, what version of java does the tomcat run on?
The tomcat console writes the whole 'path'
and the cmd says it is java version 7 currently running in the system.
Someone please help me out.. I have java 5,6,7 versions installed in my system and also tomcat 5,6,7.
Now what is the tomcat's java version and the system's java version???

Upvotes: 18

Views: 70460

Answers (7)

Theri Muthu Selvam
Theri Muthu Selvam

Reputation: 162

check JRE_HOME is configured in system variables or not, if yes that's the java tomcat is using, if not then JAVA_HOME is the one being used by your tomcat.

Upvotes: 0

user24185
user24185

Reputation: 31

The java version is written in the log file right after tomcat start. Just look keyword "Java Home" in Catalina log logs\catalina.yyyy-mm-dd.log.

Nov 23, 2020 3:56:19 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Java Home:             C:\Program Files\Java\jre1.8.0_251 

Upvotes: 2

jumping_monkey
jumping_monkey

Reputation: 7865

If you are running Tomcat from Eclipse, the JVM version that Tomcat will use is the one that is the checked JRE in the Installed JREs.

Example:

enter image description here

Check:

enter image description here

Bonus:

If you want to find out which Tomcat's version is compatible with which version of Java, check it out here

Upvotes: 1

duvo
duvo

Reputation: 1734

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

Upvotes: 5

Ring
Ring

Reputation: 2309

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

Upvotes: 20

FelixD
FelixD

Reputation: 639

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".

Upvotes: 26

NimChimpsky
NimChimpsky

Reputation: 47310

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.

Upvotes: 1

Related Questions