TeamCity Version 3.0 EAP (build 5644)

I want to put env.JAVA_HOME or somehow force it to use the JAVA_HOME jdk
on the agent - JAVA_HOME is set to C:\Program Files\Java\jdk1.6.0_02,
but if I leave the JDK home path blank - it uses the Agent jdk (which
isn't 1.6), I've tried JAVA_HOME, env.JAVA_HOME and %env.JAVA_HOME% in
this edit box -- nothing works except putting the hardcoded path
"C:\Program Files\Java\jdk1.6.0_02" in that box.

How is this supposed to work? Is this a bug?

Hi Chris,

Are you absolutely sure that JAVA_HOME environment variable is set for the build agent process? If it is, the value of %env.JAVA_HOME% should work just fine.

Please also try to specify env.JAVA_HOME in buildAgent.properties fie on the build agent (buildAgent/conf/buildAgent.properties) . Remember that you should use
instead of \ in this file when specifying path to JAVA_HOME.

Hope this helps,
KIR

Kirill Maximov (JetBrains) wrote:

Hi Chris,

Are you absolutely sure that JAVA_HOME environment variable is set for the build agent process? If it is, the value of %env.JAVA_HOME% should work just fine.

Ah ... seems this fell to my lack of understanding.

The build agent's buildAgent.properties file comes pre-configured with
an env.JAVA_HOME=c:\TeamCity\jre setting. So even though I had a
JAVA_HOME environment var setup properly, it wasn't being seen (I
figured this out on the Agents tab -> Env variables view).

So ... removing the setting inside buildAgent.properties and restarting
the agent, now it sees the originally configured ENV variable JAVA_HOME.

FWIW, that was a bit confusing. For my money, I'd probably rather have
the env.JAVA_HOME be a default only if the JAVA_HOME isn't specified in
the env variables -- whereas the TeamCity setting seems to override
whatever I configured on the machine.

Chris,

env.JAVA_HOME most probably was set in the buildAgent.properties file during agent installation. It means that agent installer did not manage to find any Java installed on the computer (JAVA_HOME-provided value is used if it is detected at the time of installation) and suggested it's own Java in the properties configuration dialog.

BTW, you can always check the values set in the agent's configuration file right in the web UI: in agent's properties on "Environment variables" tab.

--
Best regards,

Yegor Yarko
Quality Assurance Engineer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"