1

I have this strange situation with Tomcat8.exe in Windows 10.

My JAVA_HOME environment variable defined in Windows System environment points at JDK 1.8 path:

JAVA_HOME=C:\Program Files\Java\jdk1.8.0_65

When I run "C:\Program Files\Apache Software Foundation\Tomcat 8.0\bin\Tomcat8.exe", the server starts with another JDK, as I can see in catalina.log:

12-May-2016 08:57:28.250 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server version:        Apache Tomcat/8.0.30
12-May-2016 08:57:28.253 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server built:          Dec 1 2015 22:30:46 UTC
12-May-2016 08:57:28.254 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server number:         8.0.30.0
12-May-2016 08:57:28.254 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Name:               Windows 8
12-May-2016 08:57:28.255 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Version:            6.2
12-May-2016 08:57:28.255 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Architecture:          amd64
12-May-2016 08:57:28.255 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Java Home:             C:\Program Files\Java\jdk1.7.0_79\jre
12-May-2016 08:57:28.256 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Version:           1.7.0_79-b15
12-May-2016 08:57:28.256 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Vendor:            Oracle Corporation
12-May-2016 08:57:28.256 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_BASE:         C:\Program Files\Apache Software Foundation\Tomcat 8.0
12-May-2016 08:57:28.257 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_HOME:         C:\Program Files\Apache Software Foundation\Tomcat 8.0
12-May-2016 08:57:28.257 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.home=C:\Program Files\Apache Software Foundation\Tomcat 8.0
12-May-2016 08:57:28.258 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.base=C:\Program Files\Apache Software Foundation\Tomcat 8.0
12-May-2016 08:57:28.259 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.endorsed.dirs=C:\Program Files\Apache Software Foundation\Tomcat 8.0\endorsed
12-May-2016 08:57:28.261 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.io.tmpdir=C:\Program Files\Apache Software Foundation\Tomcat 8.0\temp
12-May-2016 08:57:28.261 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
12-May-2016 08:57:28.262 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.config.file=C:\Program Files\Apache Software Foundation\Tomcat 8.0\conf\logging.properties
12-May-2016 08:57:28.264 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: exit
12-May-2016 08:57:28.265 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Xms128m
12-May-2016 08:57:28.266 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Xmx256m
12-May-2016 08:57:28.267 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Apache Software Foundation\Tomcat 8.0\bin;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\ProgramData\Oracle\Java\javapath;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files\Java\jdk1.8.0_65\bin;.

I don't understand the source of "Java Home: C:\Program Files\Java\jdk1.7.0_79\jre".

I tried a find in files search of "1.7" in all Tomcat files and subfolders, the only occourence appears in the logs...

The destination of the link is "C:\Program Files\Apache Software Foundation\Tomcat 8.0\bin\Tomcat8.exe", there are no others variables.

Furthermore, the JDK 1.7 is not in the system Path!

How can I force the JDK 1.8?

Thanks in advance.

EDIT

This is the print of set command in prompt:

C:\Program Files\Apache Software Foundation\Tomcat 8.0\bin>set
ALLUSERSPROFILE=C:\ProgramData
APPDATA=C:\Users\Alessandro\AppData\Roaming
CommonProgramFiles=C:\Program Files\Common Files
CommonProgramFiles(x86)=C:\Program Files (x86)\Common Files
CommonProgramW6432=C:\Program Files\Common Files
COMPUTERNAME=ASUS-B551L-09
ComSpec=C:\WINDOWS\system32\cmd.exe
configsetroot=C:\WINDOWS\ConfigSetRoot
DOCKER_TOOLBOX_INSTALL_PATH=C:\Program Files\Docker Toolbox
FPS_BROWSER_APP_PROFILE_STRING=Internet Explorer
FPS_BROWSER_USER_PROFILE_STRING=Default
FP_NO_HOST_CHECK=NO
HOMEDRIVE=C:
HOMEPATH=\Users\Alessandro
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_65
LOCALAPPDATA=C:\Users\Alessandro\AppData\Local
LOGONSERVER=\\ASUS-B551L-09
NUMBER_OF_PROCESSORS=4
OS=Windows_NT
Path=C:\ProgramData\Oracle\Java\javapath;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\GTK2-Runtime\bin;C:\Program Files\TortoiseSVN\bin;C:\Program Files\Java\jdk1.8.0_65\bin;C:\Program Files\Git;C:\Program Files\7-Zip;C:\Program Files\nodejs\;C:\Program Files\Docker Toolbox;C:\Users\Alessandro\AppData\Roaming\npm
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
PROCESSOR_ARCHITECTURE=AMD64
PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 69 Stepping 1, GenuineIntel
PROCESSOR_LEVEL=6
PROCESSOR_REVISION=4501
ProgramData=C:\ProgramData
ProgramFiles=C:\Program Files
ProgramFiles(x86)=C:\Program Files (x86)
ProgramW6432=C:\Program Files
PROMPT=$P$G
PSModulePath=C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules\
PUBLIC=C:\Users\Public
SESSIONNAME=Console
SystemDrive=C:
SystemRoot=C:\WINDOWS
TEMP=C:\Users\Alessandro\AppData\Local\Temp
TMP=C:\Users\Alessandro\AppData\Local\Temp
USERDOMAIN=ASUS-B551L-09
USERDOMAIN_ROAMINGPROFILE=ASUS-B551L-09
USERNAME=Alessandro
USERPROFILE=C:\Users\Alessandro
VBOX_MSI_INSTALL_PATH=C:\Program Files\Oracle\VirtualBox\
windir=C:\WINDOWS
Alessandro C
  • 3,310
  • 9
  • 46
  • 82
  • 1
    The environment variables are inherited from the process you use to start tomcat. If this process was started before the change of JAVA_HOME it may still have the old value and therefore the tomcat inherits the old value. Log off and on again or reboot your system. – Robert May 12 '16 at 07:46
  • Already done several times, I noticed the problem yesterday, I have reboot this morning but the issue is still present. – Alessandro C May 12 '16 at 07:49
  • Start `cmd`, run `set` and post it here. Maybe there are other system variables that affect this behavior. Just a guess. – Sergei Tachenov May 12 '16 at 08:08
  • I have added the prompt result. – Alessandro C May 12 '16 at 08:12

3 Answers3

5

Thanks to Jacek Cz, I have found the solution.

This was the configuration of Tomcat, visible in the panel that can be launched from:

"Windows Icon / All Apps / Apache Tomcat 8 / Configure"

Going to the tab Java, there was setted the JDK 1.7. Changing this variable, Tomcat starts with the correct JDK.

Apache Tomcat 8.0 Tomcat8 Properties

Alessandro C
  • 3,310
  • 9
  • 46
  • 82
4

When started as a Windows service (in a typical Windows installation), Tomcat gets the JVM path from the Java tab, visible from systray/configure.

All Java paths for Tomcat depend on this main path.

I guess, the sense of such design is: after Java upgrade Tomcat can run with old, checked JVM, until admin modify.

Edd
  • 1,350
  • 11
  • 14
Jacek Cz
  • 1,872
  • 1
  • 15
  • 22
1

I guess JAVA_HOME variables is getting overridden by tomcat.

Please check startup.bat and catalina.bat files to check if JAVA_HOME variable is defined which I guess will be defined there.

Please check those files under tomcat bin folder.

shankarsh15
  • 1,947
  • 1
  • 11
  • 16
  • I have already tried to add set JAVA_HOME="C:\Program Files\Java\jdk1.8.0_65\bin" in catalina.bat, but it did not worked. In startup.bat there are no occourences of JAVA_HOME – Alessandro C May 12 '16 at 08:08
  • Please check this post: http://stackoverflow.com/questions/5492937/windows-ignores-java-home-how-to-set-jdk-as-default – shankarsh15 May 12 '16 at 08:13
  • It depends on the Windows Registry? But which key should I investigate? – Alessandro C May 12 '16 at 08:22