Upgrade TeamCity 2021.2 from Java 8 to Java 11



We have TeamCity 2021.2 installed on our Windows Server 2016.

TeamCity notify us to upgrade from Java 8 to Java 11.

I have installed amazon-corretto- as recommanded in TeamCity documentation.

When i go to TeamCity > Administration > Diagnostics, i still have :

Java version: 1.8.0_202
Java VM info: OpenJDK Server VM (32 bit)
Java Home path: c:\TeamCity\jre
Server: Apache Tomcat/8.5.72
JVM arguments:
-Djava.util.logging.config.file=c:\TeamCity\bin\..\conf\logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djdk.tls.ephemeralDHKeySize=2048 -Djava.protocol.handler.pkgs=org.apache.catalina.webresources -Xrs -Xmx1024m -Dteamcity.configuration.path=../conf/teamcity-startup.properties -Dlog4j.configuration=file:../conf/teamcity-server-log4j.xml -Dteamcity_logs=c:\TeamCity\bin\..\logs -Dignore.endorsed.dirs= -Dcatalina.base=c:\TeamCity\bin\.. -Dcatalina.home=c:\TeamCity\bin\.. -Djava.io.tmpdir=c:\TeamCity\bin\..\temp 

Amazon Correto Open JDK 11 was installed here : C:\Program Files\Amazon Corretto\jdk11.0.13_8

I really don't know what to do to tell TeamCity to switch from
c:\TeamCity\jre (java8)
C:\Program Files\Amazon Corretto\jdk11.0.13_8 (java 11)


Thanks for your help !





Hi! TeamCity will always prioritize the bundled Java installation (<TC_home>/jre) over the installation to which JAVA_HOME is pointing. You can stop the server and rename or remove the <TC_home>/jre folder to resolve that. Ensure that you have set JAVA_HOME correctly before you start the server again, though.

Additionally, if there is a build agent running on the same server, edit <Agent_home_dir>/conf/buildAgent.properties and <Agent_home_dir>\launcher\conf\wrapper.conf files to point to your java installation, otherwise, the agent might not start. Look for env.TEAMCITY_JRE in the buildAgent.properties file and wrapper.java.command in wrapper.conf file.

Please note that the 64-bit JVM will require more heap memory to run TeamCity than the 32-bit version. I'd recommend setting max JVM heap size to at least 2 GB (related doc).



Thanks a lot !

In TeamCity UI, where can i set JAVA_HOME please ?

I can't find it :(


No problem! As for JAVA_HOME, it is set not in TeamCity but in the OS (e.g., in Windows, you can find the env. variables in System Properties > Advanced > Environment Variables...). You will need to make sure that the variable named JAVA_HOME is pointing to your Java 11 installation. Please see Amazon docs for the installation instructions.


It works well, thanks a lot !


Will the TeamCity upgrade process ever upgrade the bundled version of JRE?   I see that the docs say Coretto is the current bundled version of JRE, but we still have Java version: 1.8.0_202 installed in TeamCityHome\jre



Currently, bundled Java is not upgraded automatically. Here's the feature request to implement auto-upgrade: https://youtrack.jetbrains.com/issue/TW-50725.


Please sign in to leave a comment.