Show TOC

Building Using Different JDK VersionsLocate this document in the navigation structure

Use

To trigger the build of a build variant of a development component (DC), Component Build Service (CBS) has to prepare the sources of the DC itself and libraries of the DC dependencies (that is, the public part artifacts) in the file system. Then CBS sends the command for building the DC build variant to the build tool and waits for the result. Note that CBS delegates the task of building DCs to a build tool process. This build tool process is started by CBS for each build request. Technically speaking, the process is a Java application which takes commands using standard input (for example, build a DC) and reports the results using standard output (for example, build OK).

There are two types of build requests for the build tool process, that are triggered by the CBS: activation request and DC build request .

If the build is successful, CBS continues with the remaining DC build variants in this build request.

Activation Request Behavior

Once all DC build variants are successfully built, CBS collects the result (public part artifacts) from the file system and updates the content and metadata in the CBS database. Then CBS instructs the build tool to terminate itself. Finally, the build request state is changed from PROCESSING to SUCCESSFUL . If some error is reported by the build tool when building a DC build variant, CBS stops building more DCs in this request, and sets the build request state to FAILED .

DC Build Request

If you trigger a DC build request (for example, from a Web UI or a command line tool), the request is successful regardless of the compilation status. The reason for this is that a request has transactional behavior. If the request is successful, then the build space state changes (for example, DC OK becomes DC broken ).

Build Tool

Note that the build tool serves as the runtime environment for the build plug-ins. The build plug-in dependencies are declared on DC level and the artifacts then come from the build space. The JRE used for execution of the build tool, must be compatible with the build plug-in libraries. For example, to build an SAP NetWeaver 7.1 build space at least JDK 1.5 has to be used for the build tool.

Furthermore, the build tool itself and its dependent libraries must be provided as well - the DC tc/bi/buildtool in SAP_BUILDT assembles everything needed for the build tool to run. Note that the JDK used as runtime must be compatible with these libraries, too.

How does CBS handle multiple JDK versions?

CBS uses two service properties for configuring JDKs used for the build. These two settings combined with build options in the development configuration determine which JDK is used when compiling Java sources during a DC build:

  • BUILD_TOOL_JDK_HOME property defines the virtual machine (VM) that executes the build environment including Ant. Due to compatibility restraints, this VM should be configured to the highest version available (or used on the CBS), or leave it empty to let CBS automatically decide.

  • JDK_HOME_PATHS property defines a list of key-value pairs where the key is typically something like JDK<version>_HOME and the corresponding value is the path where the JDK is actually installed on the server. There is also the special key default that defines which JDK should be used as default.

Recommendation

We recommend that you set the value of BUILD_TOOL_JDK_HOME to default .

Figure 1: What JDK Should be Used?

The JDK to be used for the Java compiles is determined the following way:

  1. The value of the BUILD_TOOL_JDK_HOME property is checked.

  2. If the BUILD_TOOL_JDK_HOME property is defined with a concrete value, then this value is used by the build tool

  3. If the BUILD_TOOL_JDK_HOME property is not defined, or if it has the value default , then the build tool location is checked.

    1. If the build tool is not located in the build space, the JDK of the Application Server Java (AS Java) is used.

    2. If the build tool is located in the build space, then the build option com.sap.jdk.home_path_key in JDK_HOME_PATHS is used.

Note

The JDK_HOME_PATHS is set to:

JDK1.3.1_HOME=C:\jdk1.3.1_15;JDK1.4.2_HOME=C:\j2sdk1.4.2_09;JDK1.5.0_HOME=F:\jdk1.5.0_06;default=C:\j2sdk1.4.2_09

and BUILD_TOOL_JDK_HOME is set to F:\jdk1.5.0_06 .

  • If the build option com.sap.jdk.home_path_key (or a supported legacy option) is not set, the build will be executed on a JDK 5.0 VM, but the Java compiler will be forked to C:\j2sdk1.4.2_09 as that is defined as default.

  • If the build variant has com.sap.jdk.home_path_key (or a supported legacy option) set to JDK1.6.0_HOME, the build will fail since no valid local JDK has been defined in JDK_HOME_PATHS for the key JDK1.6.0_HOME.

  • If the build variant has com.sap.jdk.home_path_key (or a supported legacy option) set to JDK1.4.2_HOME, the build will be executed on a JDK 5.0 VM, but the Java compiler will be forked to C:\j2sdk1.4.2_09.

  • If the build variant has com.sap.jdk.home_path_key (or a supported legacy option) set to JDK1.5.0_HOME, the build will be executed on a JDK5.0 VM and the Java compiler will be executed within the same VM (unless options are set to explicitly fork the compiler).

How does the Developer Studio handle multiple JDK versions?

The BUILD_TOOL_JDK_HOME corresponds to the JDK that is used to start the Developer Studio. You must start the Developer Studio with a full JDK in order to perform DC builds within the Developer Studio. A JRE is not sufficient. A typical symptom is an error message in the build log that no Java compiler could be found.

The JDK_HOME_PATHS that are relevant for development can be configured using the Developer Studio's parameters file. Due to historical reasons, the keys JDK1.3.1_HOME and JDK1.4_HOME are automatically set to the VM that started the Developer Studio.

Procedure

Using single JDK for build

To use one and the same JDK for your build variants and the build tool, you manually configure the JDK used as the build tool execution environment. To do that you specify the JDK location path in the BUILD_TOOL_JDK_HOME CBS service property.

  1. Open the SAP NetWeaver Administrator tool.

    To do that in your browser open: http://<host>:<port>/nwa .

  2. Navigate to Java System Properties page.

    To find the Java System Properties page, the easiest way is to type Java System Properties in the Search field of the SAP NetWeaver Administrator tool and choose the Go pushbutton.

  3. Select the configuration template you want to use, and open its Services tab page. Choose Component Build Service from the list of services.

    To find the Component Build Service, the easiest way is to type component build service in the Search field of the Services tab page and choose Enter on your keyboard.

  4. In the Properties tab page select the BUILD_TOOL_JDK_HOME property.

  5. Choose the Modify pushbutton and in the dialog that appears, specify the location of the JDK you want to use.

Building using different JDKs for the build variants and the build tool

  1. Open the SAP NetWeaver Administrator tool. Navigate to Java System Properties page. Select the configuration template you want to use, and open its Services tab page. Choose Component Build Service from the list of services

  2. In the Properties tab page, select the JDK_HOME_PATHS property.

  3. Choose the Modify pushbutton and in the dialog that appears, specify the location of the JDKs you want to use. For example, JDK1.6_HOME=D:\JAVA\HOME16;default=<location of the default JDK to be used>;JDK1.5_HOME=<location of the 1.5 JDK> .

  4. Make sure that the BUILD_TOOL_JDK_HOME property does not specify any value. Otherwise, it overwrites the JDK_HOME_PATHS property you just specified.