Dashboard > Terracotta Developer Documentation > ... > Development Process > Coding > Building Terracotta > Configuring JDK Versions
  Terracotta Developer Documentation Log In   View a printable version of the current page.  
  Configuring JDK Versions
Added by Jason Voegele, last edited by Jason Voegele on Apr 02, 2007  (view change)
Labels: 
(None)

Configuring JDK Versions

By default, the Terracotta build tool, tcbuild, uses a Java 1.4 SDK and either JDK 5 or JDK 6 for compiling code and running tests. The use of a Java 1.4 SDK helps to ensure that certain modules within the Terracotta source retain compatibility with Java 1.4.

tcbuild needs to be told where to find the JDK installations that it uses, which you do by setting certain configuration elements. A configuration element is a name-value pair that can be specified in any of the following ways:

  1. On the tcbuild command-line
  2. In the buildconfig file for a module
  3. In build-config.local
  4. In build-config.global
  5. As an environment variable, optionally prefixed with TC_

Environment variables are the preferred option for specifying the configuration elements related to the JDK version.

To tell tcbuild where to find the Java 1.4 SDK installations, use either the J2SE_14 or the JAVA_HOME_14 configuration element. To tell tcbuild where to find JDK 5 or JDK 6, use any of the following: J2SE_15, JAVA_HOME_15, JAVASE_16, or JAVA_HOME_16.

Overriding JDK Selection

Here is an overview of how JDKs are handled by tcbuild:

The file jdk.def.yml contains the specifications for the JDKs used by tcbuild. Currently it contains a specification for J2SE-1.4 and J2SE-1.5. Any JDK listed in this file MUST be installed for tcbuild to work. Therefore, it is still required to have both a 1.4 SDK and either JDK 5 or JDK 6 installed.

The default JDK to use for a module is specified in modules.def.yml.

You can override the default JDK for compiling/testing/running by specifying a jdk= option on the command-line or in a buildconfig file. The value of the jdk= option may be either the name of a JDK specified in jdk.def.yml, or the path to a Java installation. For example:

./tcbuild check_one SomeTest jdk=/usr/local/jdk1.6.0

You can override the JDK used for running tests only (allowing the default JDK to be used for compilation and other purposes) by specifying the tests-jdk= option on the command-line or in a buildconfig file. As for the jdk= option, the tests-jdk= option may be either the name of a JDK specified in jdk.def.yml, or the path to a Java installation.

The search order for selecting the appropriate JDK is as follows:

For compiling classes and running class main() method or running DSO server:
  1. Command-line jdk= option
  2. Subtree buildconfig jdk= option
  3. modules.def.yml jdk: attribute
For running non-container tests:
  1. Command-line tests-jdk= option
  2. Subtree buildconfig tests-jdk= option
  3. Command-line jdk= option
  4. Subtree buildconfig jdk= option
  5. modules.def.yml jdk: attribute
For running container tests:
  1. Command-line tests-jdk= option
  2. Subtree buildconfig tests-jdk= option
  3. Command-line jdk= option
  4. Subtree buildconfig jdk= option
  5. appservers.yml entry for active appserver
  6. modules.def.yml jdk: attribute

In any case, an error is raised if the JDK selected is incompatible with the task being performed. For example, if the tests-jdk= option is set to a JDK 5 installation, but the app server is compatible only with Java 1.4, tcbuild will refuse to use the JDK 5 and the build will fail.

Powered by Atlassian Confluence, the Enterprise Wiki. (Version: 2.5.5 Build:#811 Jul 25, 2007) - Bug/feature request - Contact Administrators