Unable to restore from backup JAVA_HOME, JRE_HOME not defined.

Prior to wiping a server I ran a backup up my TC 8.x version as it had about 40 or so projects on it. This created about 7mbs of data to a .zip file. I used the backup tool from admin panel.
I am now trying to restore on a brand new install. Using internal database right now. I tried following obscure instructions here   https://confluence.jetbrains.com/display/TCD8/Restoring+TeamCity+Data+from+Backup but failed.

I am trying to do this from powershell script as the error i keep getting is that the JAVA_HOME and JRE_HOME variables are not installed.
I can see however in my environment variables (my compputer > advanced > environment variables)  both the JAVA_HOME and JRE_HOME vars pointing to c:\teamcity\jre\bin and c:\teamcity\jre.

Default install of teamcity 8.1.5.
data dir = c:\programData\jetbrains\teamcity
app dir = c:\teamcity
copied the template ( .BuildServer\config\database.hsqldb.properties.dist) as c:\temp\database.properties
from powershell :
PS C:\> [Environment]::SetEnvironmentVariable("JAVA_HOME", "C:\TeamCity\jre\bin", "Machine")
PS C:\> [Environment]::SetEnvironmentVariable("JRE_HOME", "C:\TeamCity\jre", "Machine")
PS C:\> C:\TeamCity\bin\maintainDB.cmd restore -F C:\Temp\TeamCity_Backup_20140730_113600.zip -A C:\ProgramData\JetBrains\TeamCity -T C:\Temp\database.properties

The error I keep getting back is the following:

Java executable is not found:
- Neither the JAVA_HOME nor the JRE_HOME environment variable is defined
- Java executable is not found in the directories listed in the PATH environment variable
- Path to JVM is not found in Windows Registry.
- Java executable is not found in the default locations

the same error pops from a windows cmd prompt.
Can anyone explain to me what I am doing wrong. Some sources say I need to install the java SDK but the instructions make no mention of this.
Appreciate any feedback. Would really like to get my projects back.

Comment actions Permalink


Could you please try to set JAVA_HOME to "c:\teamcity\jre"? Also please check that java.exe exists in c:\teamcity\jre\bin folder.

Comment actions Permalink

Hi Alina.
If I understand you correctly you are saying that both JRE_HOME and JAVA_HOME should both point to the same location? c:\teamcity\jre? I do not need to use jre\bin in an environment variable?

Comment actions Permalink

JAVA_HOME should point to the JDK or JRE installation. Also could you please check in console where you start the maintainDB script that these variables are set correctly?

Comment actions Permalink

Thanks for your assistance. This was the issue. I just needed to ensure the JAVA_HOME variable was set the same as the console settings found at admin > diagnostics > internal properties.


Please sign in to leave a comment.