TeamCity default jdk for buildAgent on linux

teamcity

I'm trying to run a TeamCity (default) build agent with 32-bit java on ubuntu 64-bit, I have created a [TeamCity]/bin/setenv.sh what contains:

JAVA_HOME=/usr/lib/jvm/ia32-java-6-sun

That works fine running the server with 32-bit jre, but not for the agent: I've tried these lines in [buildAgent]/conf/buildAgent.properties

JAVA_HOME=/usr/lib/jvm/ia32-java-6-sun
JRE_HOME=/usr/lib/jvm/ia32-java-6-sun/jre

and also a '[buildAgent]/jre' link

[buildAgent]/jre -> /usr/lib/jvm/ia32-java-6-sun/jre/

when I do a '[TeamCity]/bin/runAll.sh start' I get this:

Using CATALINA_BASE:   /srv/TeamCity
Using CATALINA_HOME:   /srv/TeamCity
Using CATALINA_TMPDIR: /srv/TeamCity/temp
Using JRE_HOME:        /usr/lib/jvm/ia32-java-6-sun
Using CLASSPATH:       /srv/TeamCity/bin/bootstrap.jar:/srv/TeamCity/bin/tomcat-juli.jar
Starting TeamCity build agent...
Java executable is found in '/usr/bin/..'.
Starting TeamCity Build Agent Launcher...
Agent home directory is /srv/TeamCity/buildAgent
Current Java runtime version is 1.6
Lock file: /srv/TeamCity/buildAgent/logs/buildAgent.properties.lock
Using no lock
Done [16436], see log at ../logs/teamcity-agent.log

As you can see from the output, the server is using 32-bit jdk, but the build agent is running the java found in '/usr/bin' (which is 64-bit in my case).

Closer inspection of the '[buildAgent]/bin/findJava.sh', it looks like the script runs a 'which java' and finds the default system java before it even tries any of the supplied args/folders. I think it should find '[buildAgent]/jre' before the system java.

Whats the correct way to specify the java version to use for a build agent, which may be a different version than the server?

Should I just modify findJava.sh to check its arguments before checking the system path for java?

Best Answer

You need to set JDK version of the buildAgent in the settings page of the project.

The JRE versions you specified are for Teamcity server. If you go to Edit Configuration Settings page of the project, there's Build Step link. In the Build Step page, you can specify JDK and JDK home path.

Related Topic