In this post, I will explain how to upgrade JRE when you run Teamcity on Windows.
You can upgrade Java in Teamcity without touching the JRE folder located in the installation folder.
- I’m going to use JDK 11. Teamcity is suggesting using the 11th version.
- You will need to restart the machine or the Teamcity service. Keep it in mind if you have builds running during the upgrade.
- You will need to add or update environment variables. In my case, I’m adding the TEAMCITY_JRE variable. If you already set JRE_HOME or JDK_HOME with Teamcity or another app, please, read the documentation first.
You can install JDK with the Windows installer or extract the zip files into a custom folder. You will only need the path of the environment variable.
Furthermore, you can check the Java version and the installation path in «Administration/ Diagnostic/ Java configuration.» You installed a bundled version of the JRE location is the same as the Teamcity folder. This is my case.
Add environment variable.
Open the environment variables window, «This Pc / Properties / Advanced System Settings / Environment Variables… / System variables / New». Use the path of your JDK.
Variable Name: TEAMCITY_JRE Variable value: C:\Program Files\Java\jdk-220.127.116.11
Restart Teamcity or Service.
You will need to restart the Windows Service or the machine. Rebooting the pc is optional. If you restart Teamcity from the UI, you won’t see the new Java version reflected in the diagnostic section.