Symptoms
A new Java version is installed on the TeamCity server machine. The JAVA_HOME environment variable points to this new version, and the path to the Java bin is added to the PATH environment variable. Executing java -version in the command line shows the new version.
However, the TeamCity server still uses the old version of Java when starting.
Cause
Most probably, the <TeamCity Home>/jre directory exists, and Java found in this directory is being used.
When this directory exists, it will always be used over the JDK/JRE pointed to by JAVA_HOME. How TeamCity selects the Java to run the server process is described in the documentation:
TeamCity selects the Java version to run the server process as follows:
- By default, if your TeamCity installation has a bundled JRE (the
<TeamCity Home>/jredirectory exists), it will be used to run the TeamCity server process. To use a different JRE, specify its path via theTEAMCITY_JREenvironment variable.- If there is no
<TeamCity Home>/jredirectory present, TeamCity looks for theJRE_HOMEorJAVA_HOMEenvironment variable pointing to the installation directory of JRE or JVM (Java SDK) respectively. If both variables are declared, JRE will be used.
Resolution
To use the JRE outside of <TeamCity Home>/jre, specify its path via the TEAMCITY_JRE environment variable.
Alternatively, it is possible to copy the contents of the JAVA_HOME directory to <TeamCity Home>/jre:
If your TeamCity installation has a bundled JRE (there is the
<TeamCity Home>\jredirectory), update it by installing a newer JRE per installation instructions and copying the content of the resulting directory to replace the content of the existing<TeamCity Home>\jredirectory.
Comments
0 comments
Please sign in to leave a comment.