Need to verify tomcat's version on the server while running ansible playbooks. The only way I know to do that is:
[root#server ~]# cd /usr/share/tomcat8/bin/
[root#server bin]# ./version.sh
Using CATALINA_BASE: /usr/share/tomcat8
Using CATALINA_HOME: /usr/share/tomcat8
Using CATALINA_TMPDIR: /usr/share/tomcat8/temp
Using JRE_HOME: /usr
Using CLASSPATH: /usr/share/tomcat8/bin/bootstrap.jar:/usr/share/tomcat8/bin/tomcat-juli.jar
Server version: Apache Tomcat/8.0.30
Server built: Dec 1 2015 22:30:46 UTC
Server number: 8.0.30.0
OS Name: Linux
OS Version: 2.6.32-504.1.3.el6.x86_64
Architecture: amd64
JVM Version: 1.8.0_66-b17
JVM Vendor: Oracle Corporation
Is there any other way? This one isn't the nicest one since even the directory of this version.sh script changes depending on tomcat version and there is a lot of parsing to do.
there are several ways to do this you can find them here
open http://localhost:8080/ in your web browser and version should be visible there.
execute the version.sh script in your tomcat/bin directory.
you can check it in release notes.
you can also check the version through java -cp catalina.jar org.apache.catalina.util.ServerInfo
source: how to find out running tomcat version
./version.sh calls
./catalina.sh version
which calls
java -classpath "$CATALINA_HOME/lib/catalina.jar" org.apache.catalina.util.ServerInfo
My current running Tomcat is as following
Tomcat Version : Apache Tomcat/5.5.36
Servlet Specification Version : 2.4
JSP version : 2.0
I need to change it to
Tomcat Version : Apache Tomcat/8.0.14
Servlet Specification Version : 3.1
JSP version : 2.3
I downloaded Tomcat version 8 and I have following, how can I run Tomcat 8 and make it default of the server?
root#server [/opt]# ls
./ cpanel/ pcre/
../ curlssl/ php_with_imap_client/
apache-tomcat-8.0.18/ jdk1.7.0_75/ suphp/
apache-tomcat-8.0.18.tar.gz jdk-7u75-linux-x64.tar.gz xml2/
I tried following command but it failed.
root#server [/opt/apache-tomcat-8.0.18/bin]# ./startup.sh
Cannot find apache-tomcat-8.0.18/bin/setclasspath.sh
This file is needed to run this program
~/.bashrc
# .bashrc
# User specific aliases and functions
alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
JAVA_HOME="/usr/lib/jvm/jre-1.7.0-openjdk.x86_64"
export JAVA_HOME
PATH=$JAVA_HOME/bin:$PATH
export PATH
export CATALINA_HOME="apache-tomcat-8.0.18"
Java Version
java -version
java version "1.7.0_75"
OpenJDK Runtime Environment (rhel-2.5.4.0.el6_6-x86_64 u75-b13)
OpenJDK 64-Bit Server VM (build 24.75-b04, mixed mode)
root#server [/opt/apache-tomcat-8.0.18/bin]#
O/S
Linux server.myproject.com 2.6.32-220.13.1.el6.x86_64 #1 SMP Tue Apr 17
23:56:34 BST 2012 x86_64 x86_64 x86_64 GNU/Linux
The Tomcat startup.sh script uses $CATALINA_HOME to find setclasspath.sh, which is the cause of your failed startup. Therefore, $CATALINA_HOME needs to be an absolute path to your tomcat installation directory, e.g.
export CATALINA_HOME="/opt/apache-tomcat-8.0.18"
If you plan on upgrading again, you might consider setting $CATALINA_HOME to /opt/tomcat, then you would create a symbolic link from /opt/tomcat to /opt/apache-tomcat-8.0.18 or whatever future version you end up installing. Since you will likely have multiple environmental variables pointing to your tomcat directory, this gives you a single change point when updating references.
ln -nsf /opt/apache-tomcat-8.0.18 /opt/tomcat
I have installed JAVA 1.6 on Redhat Linux 4 and wanted to function it with tomcat 5.5 but i am facing the below issue:
When I am stopping the tomcat server it is taking JAVA 1.6 , but when I am bringing it up , it is taking JAVA 1.5(this one is pre-installed and currently working).
I am not understanding where i am missing. Please help me on this. I am really naive but hope to understand these things through you.
Points:
Server has already installed JAVA 1.5 which is currently working. I want to change the JAVA to 1.6 from 1.5
JAVA 6 has been installed in the directory --> /usr/java/jdk1.6.0_25/
I have only changed tomcat start up file JAVA_HOME variable to
export JAVA_HOME=/usr/java/jdk1.6.0_25/
when i am stopping the server, it shows,
Using JRE_HOME: /usr/java/jdk1.6.0_25/
When I am starting the tomcat server, it shows,
Using JRE_HOME: /apps/UTCinet-WK/jdk1.5.0_03
many thanks in advance
java -version
java version "1.6.0_25"
Java(TM) SE Runtime Environment (build 1.6.0_25-b06)
Java HotSpot(TM) Server VM (build 20.0-b11, mixed mode)
and when i stop the server, it shows:
Using CATALINA_BASE: /apps/xxxx/tomcat/xxx/xxxx
Using CATALINA_HOME: /apps/xxxx/jakarta-tomcat-5.5.9
Using CATALINA_TMPDIR: /apps/xxxx/tomcat/xxxx/xxxx/temp
Using JRE_HOME: /usr/java/jdk1.6.0_25/
Confirming shutdown completion - 5 xxxxonds..
and when i start the server, it shows:
Setting environment (DEV) from hostname. at /apps/xxxx/scripts/get_env.pl line 18.
Using CATALINA_BASE: /apps/xxxx/tomcat/xxxx/xxxx
Using CATALINA_HOME: /apps/xxxx/jakarta-tomcat-5.5.9
Using CATALINA_TMPDIR: /apps/xxxx/tomcat/xxxx/xxxx/temp
Using JRE_HOME: /apps/xxxx/jdk1.5.0_03
Check the following outputs:
1. echo $JAVA_HOME
2. echo $PATH
3. java -version
4. Check $CATALINA_HOME/bin/setenv.sh file
And if you're starting your tomcat via a service call (and not via startup.sh), check that script as well to see if the JAVA_HOME is set to something there.
Usually, fixing the setenv.sh file should do the trick.
See if you have anything spurious going on in the $CATALINA_HOME/bin/setenv.sh file. That's the "preferred" place to set things like JAVA_HOME anyway.
I'm trying to get Appfuse + Tomcat + jRebel working.
Appfuse by default uses Cargo to download tomcat (ver. 7.0.33) and deploy the application to it. I wish to use an already installed tomcat (ver. 7.0.27) instead of the downloaded one. I made the change following the appfuse FAQ.
After deploying with mvn cargo:run, how can I know that the actual running tomcat is indeed 7.0.27?
I used to type a wrong URL (ex. localhost:8080/dfsfsdf) to see it in the error page, but now it shows nothing.
My $CATALINA_HOME points to my own tomcat 7.0.27.
sorry forgot to mention, it's for Windows.
Update:
Since this question had become somehow popular, I would like to explain why that accepted answer. simple, it was the first one which solved my problem.
I am looking at the title of the question, #Tech Junkie and #CPU 100 really have the best answer, but not for the scenario I was encountered. (I was wanting to know if mvn cargo:run runs my installed tomcat or a "project embeded" tomcat) :)
Though this is not recent, I thought, my answer can still help others:
cd tomcat/lib
java -cp catalina.jar org.apache.catalina.util.ServerInfo
and that's it.
Server version: Apache Tomcat/7.0.30
Server built: May 23 2013 02:54:10
Server number: 7.0.30.0
OS Name: Linux
OS Version: 3.13.0-36-generic
Architecture: amd64
JVM Version: 1.7.0_65-b32
JVM Vendor: Oracle Corporation
Try parsing or executing the Tomcat_home/bin directory and look for
a script named version.sh or version.bat depending on your
operating system.
Execute the script ./version.sh or version.bat
If there are no version.bat or version.sh then
use a tool to unzipping JAR files (\tomcat\server\lib\catalina.jar) and look in the file org\apache\catalina\util\lib\ServerInfo.properties.
the version defined under "server.info=".
execute the script in your tomcat/bin directory:
sh tomcat/bin/version.sh
Server version: Apache Tomcat/7.0.42
Server built: Jul 2 2013 08:57:41
Server number: 7.0.42.0
OS Name: Linux
OS Version: 2.6.32-042stab084.26
Architecture: amd64
JVM Version: 1.7.0_21-b11
JVM Vendor: Oracle Corporation
if you can upload a JSP file you may print out some info like in this example: bestdesigns.co.in/blog/check-jsp-tomcat-version
Save this code into a file called tomcat_version.jsp:
Tomcat Version : <%= application.getServerInfo() %><br>
Servlet Specification Version :
<%= application.getMajorVersion() %>.<%= application.getMinorVersion() %> <br>
JSP version :
<%=JspFactory.getDefaultFactory().getEngineInfo().getSpecificationVersion() %><br>
When you access, http://example.com/tomcat_version.jsp, the output should look similar to:
Tomcat Version : Apache Tomcat/5.5.25
Servlet Specification Version : 2.4
JSP version: 2.0
You can simply open http://localhost:8080/ in your web browser
and this will open Tomcat welcome page that shows running Tomcat version like this:
Apache Tomcat/7.0.42
I assume that your Tomcat is running on port 8080
For windows machine
Go to the tomcat directory C:\apache-tomcat-x.0.xx\bin
bin>version.bat
Using CATALINA_BASE: "C:\apache-tomcat-x.0.xx"
Using CATALINA_HOME: "C:\apache-tomcat-x.0.xx"
Using CATALINA_TMPDIR: "C:\apache-tomcat-x.0.xx\temp"
Using JRE_HOME: "C:\Program Files\Java\jdk1.8.0_65"
Using CLASSPATH: "C:\apache-tomcat-x.0.xx\bin\bootstrap.jar;C:\apache-tomcat-x.0.xx\bin\tomcat-juli.jar"
Server version: Apache Tomcat/7.0.53
For Linux Machine
Go to the tomcat directory /usr/mack/apache-tomcat-x.0.xx/bin
# ./version.sh
Using CATALINA_BASE: /usr/mack/apache-tomcat-x.0.xx
Using CATALINA_HOME: /usr/mack/apache-tomcat-x.0.xx
Using CATALINA_TMPDIR: /usr/mack/apache-tomcat-x.0.xx/temp
Using JRE_HOME: /usr/java/jdk1.7.0_71/jre
Using CLASSPATH: /usr/mack/apache-tomcat-x.0.xx/bin/bootstrap.jar:/usr/mack/apache-tomcat-x.0.xx/bin/tomcat-juli.jar
Server version: Apache Tomcat/7.0.56
If Tomcat is installed as a service:
#sudo /etc/init.d/tomcat version
I had this challenge when working on an Ubuntu 18.04 Linux server.
Here's how I fixed it:
Run the command below to determine the location of your version.sh file:
sudo find / -name "version.sh"
For me the output was:
/opt/tomcat/bin/version.sh
Then, using the output, run the file (version.sh) as a shell script (sh):
sh /opt/tomcat/bin/version.sh
That's all.
I hope this helps
Using the release notes
In the main Tomcat folder you can find the RELEASE-NOTES file which contains the following lines (~line 20-21):
Apache Tomcat Version 8.0.22
Release Notes
Or you can get the same information using command line:
Windows:
type RELEASE-NOTES | find "Apache Tomcat Version"
Output:
Apache Tomcat Version 8.0.22
Linux:
cat RELEASE-NOTES | grep "Apache Tomcat Version"
Output:
Apache Tomcat Version 8.0.22
This one command which you can check almost everything:
java -cp tomcat/lib/catalina.jar org.apache.catalina.util.ServerInfo
or
tomcat/bin/catalina.sh version
And the output looks like this
Server version: Apache Tomcat/8.5.24
Server built: Nov 27 2017 13:05:30 UTC
Server number: 8.5.24.0
OS Name: Linux
OS Version: 4.4.0-137-generic
Architecture: amd64
JVM Version: 1.8.0_131-b11
JVM Vendor: Oracle Corporation
The version of currently running Tomcat
If you set the environtment variable - %CATALINA_HOME%, then
Windows :
>> cd %CATALINA_HOME%\bin
>> version
Alternatively,
java.exe -cp lib\catalina.jar org.apache.catalina.util.ServerInfo
MY SETTING --- Hope yours will be similar to as follows
%CATALINA_HOME% --- C:\Program Files\Tomcat\apache-tomcat-8.0.28
OUTPUT
Server version: Apache Tomcat/8.0.28
Server built: Oct 7 2015 18:25:21 UTC
Server number: 8.0.28.0
OS Name: Windows 7
OS Version: 6.1
Architecture: amd64
JVM Version: 1.8.0_111-b14
JVM Vendor: Oracle Corporation
To find out the Tomcat version, find this file – version.sh for *nix or version.bat for Windows. This version.sh file is normally located in the Tomcat bin folder.
phpmongodb#kumar:/usr/share/tomcat7/bin$ ./version.sh
Note
If you are not sure where is the version.sh file, try this command :
sudo find / -name "version.sh"
Find out everything about Tomcat7.
sudo find / -name "tomcat7"
run the following
/usr/local/tomcat/bin/catalina.sh version
its response will be something like:
Using CATALINA_BASE: /usr/local/tomcat
Using CATALINA_HOME: /usr/local/tomcat
Using CATALINA_TMPDIR: /var/tmp/
Using JRE_HOME: /usr
Using CLASSPATH: /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar
Using CATALINA_PID: /var/catalina.pid
Server version: Apache Tomcat/7.0.30
Server built: Sep 27 2012 05:13:37
Server number: 7.0.30.0
OS Name: Linux
OS Version: 2.6.32-504.3.3.el6.x86_64
Architecture: amd64
JVM Version: 1.7.0_60-b19
JVM Vendor: Oracle Corporation
I know it is maybe too late for this, but this could be usefull:
If you try to know Apache Tomcat Server version from Java code, you can use:
from a HttpServlet:
protected void doGet(HttpServletRequest request, HttpServletResponse response) {
getServletContext().getServerInfo()
}
from a ServletContextListener:
public void contextInitialized(ServletContextEvent event) {
event.getServletContext().getServerInfo();
}
Another option is view release notes from tomcat,applicable to linux/window
{Tomcat_home}/webapps/ROOT/RELEASE-NOTES.txt
If Tomcat is installed as a service, try:
sudo /etc/init.d/tomcat version
Swap out "tomcat" with the actual name of the service.
In Linux to check the tomcat version
cd /opt/tomcat/bin
./catalina.sh version
Enter 404.jsp or non-existent.jsp.
Get Tomcat/JBoss version number at bottom of page.
Open your tomcat home page (Usually localhost:8080)
You will see something like this:
For Windows PowerShell command-line method of checking running version(s) of Tomcat service:
(get-service Tomcat*).DisplayName
Sample output...
Apache Tomcat 8.5 Tomcat8
If also want to know additional details including the location of folder where service running at:
Get-WmiObject win32_service | Where-Object {$_.Name -like 'Tomcat*'} | select Name, DisplayName, State, PathName
Sample output...
Name DisplayName State PathName
---- ----------- ----- --------
Tomcat8 Apache Tomcat 8.5 Tomcat8 Running "C:\Program Files\Apache Software Foundation\Tomcat 8.5\bin\Tomcat8.exe" /...
run on terminal of the Unix server
w3m http://localhost:8080/
to quit press q and next y
For securing Tomcat from hackers, it's recommended that we try a few steps at hiding the tomcat version information. The OWASP project suggests a few steps. https://www.owasp.org/index.php/Securing_tomcat . If a tomcat installation is thus protected, then only 1 of the above answers will show the version of tomcat. i.e going through the $TOMCAT_HOME\RELEASE-NOTES file where the version number is clearly announced.
I had one such protected server and only the RELEASE-NOTES file revealed the version of the tomcat. all other techniques failed to reveal the version info.
We are running in a Windows environment and I had to find a way to get the Tomcat version outside of the Java environment. Without knowing the version, I could not determine the directories. I finally found the best way was to query the Tomcat service using:
C:\temp>sc query | find /I "tomcat"
SERVICE_NAME: Tomcat6
DISPLAY_NAME: Apache Tomcat 6.0 Tomcat6
You can find out the server information through its status page:
{running-tomcat-url}/manager/status
On that page you can see the version of Java on which your Tomcat runs
Note: I have also pasted this answer on Tomcat6 and JRE7 compatibility issue. Unsupported major.minor version 51.0
On Windows just cmd
C:\Program Files (x86)\Extensis\Portfolio Server\applications\tomcat\bin>version
check yout tomcat log directory.
goto /var/log/tomcat8/
view the file: catalina.out
it will show the tomcat version below:
Server version name: Apache Tomcat/8.5.72
04-Feb-2022 04:00:58.537 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server built: Oct 28 2021 00:54:01 UTC
04-Feb-2022 04:00:58.537 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server version number: 8.5.72.0
04-Feb-2022 04:00:58.537 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Name: Linux
04-Feb-2022 04:00:58.537 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Architecture: amd64
04-Feb-2022 04:00:58.537 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Version: 1.8.0_312-b07
These Following 4 ways can be used to find out Apache Tomcat Version in Linux:
1). Linux via Version Script in Tomcat Bin Directory:
Locate the Tomcat`s bin Directory that is being used
Check for version.sh script exists, i.e. ll version.sh
Execute the script either way: sh version.sh OR ./version.sh
This will output you sample as below:
2). Check Tomcat Version in Linux Command Line
ps -ef |grep -i tomcat // this is will output and you will need to eye-ball to find version, sample below
3). Get Tomcat version via Catalina.jar
Execute the following CMD in terminal, you will need to locate Lib folder in Tomcat
java -cp tomcat/lib/catalina.jar org.apache.catalina.util.ServerInfo
4). Get Tomcat version through JSP
Create JSP page with the below code
Then try to open the JSP via Tomcat in the Browser
This will output the Tomcat Version you are running.
Tomcat Version : <%= application.getServerInfo() %> Servlet
Specification Version : <%= application.getMajorVersion() %>. <%=
application.getMinorVersion() %> JSP version :
<%=JspFactory.getDefaultFactory().getEngineInfo().getSpecificationVersion()
%>
Windows task manager > Processes > find tomcat > right click > open file location > if you run Tomcat7w.exe it is visible at description.
Tomcat should running to be visible at Processes if not at Windows Vista/7 go to task manager > tab (services) find tomcat start it and then processes.
In Unix-like environments, I also recommend checking the actual running process command line:
$ ps aux | grep java
...
/usr/lib/jvm/java-8-openjdk-amd64/bin/java -Djava.util.logging.config.file=/srv/tomcat-instances/bla/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.awt.headless=true -Xmx4096M -XX:+UseConcMarkSweepGC -Djdk.tls.ephemeralDHKeySize=2048 -Djava.protocol.handler.pkgs=org.apache.catalina.webresources -agentlib:jdwp=transport=dt_socket,address=8000,server=y,suspend=n -Xmx4096m -Xms4096m -XX:MaxPermSize=2048m -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.port=8090 -Dcom.sun.management.jmxremote.rmi.port=8090 -Djava.rmi.server.hostname=localhost -Djava.endorsed.dirs=/opt/apache-tomcat-8.0.47/endorsed -classpath /opt/apache-tomcat-8.0.47/bin/bootstrap.jar:/opt/apache-tomcat-8.0.47/bin/tomcat-juli.jar -Dcatalina.base=/srv/tomcat-instances/bla -Dcatalina.home=/opt/apache-tomcat-8.0.47 -Djava.io.tmpdir=/tmp/tomcat8-bla-tmp org.apache.catalina.startup.Bootstrap start
...
One can run on subtle weird behaviors due to (operating system) environment variables and (Java) system properties being set to unexpected values. I had a situation where due to an outdated Tomcat setenv.sh, A Tomcat 8 started with classes from a Tomcat 7 on the classpath. Make sure that in the process command line options such as -Dcatalina.base, -Dcatalina.home and -classpath make sense.
Simply start tomcat and search for "Server version name" in catalina.logs and you will get version of your tomcat.
For example:
"Mar 07, 2019 11:25:40 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server version name: Apache Tomcat/9.0.16"
To know exact tomcat version alone, just visit vi tomcat/BUILDING.txt
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???
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
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
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
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.
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:
Check:
Bonus:
If you want to find out which Tomcat's version is compatible with which version of Java, check it out here