Show TOC Start of Content Area

Procedure documentation Building Using Different JDK Versions  Locate the document in its SAP Library structure

Use

You can configure the build options for a certain development configuration that you use in the SAP NetWeaver Developer Studio. This allows you to build sources with different JDK versions. In general the JDK lookup is a two step process. This is required because in NWDI you have one central development configuration where you want to define which JDK will be used and the multiple local configurations (CBS or Developer Studio) where the host-specific installation path must be defined.

How does CBS handle multiple JDK versions?

CBS uses two service properties to configure the 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. To use the build plug-ins, you must use a JDK 5.0.

·         JDK_HOME_PATHSproperty – 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 by default.

The JDK that is used for the Java compiler is determined in the following way:

...

       1.      If the build option com.sap.jdk.home_path_key is set to a valid key in JDK_HOME_PATHS, then that JDK is used to fork the Java compiler.

       2.      For legacy support, the build option ant_jdk_version is checked as the fallback and if a valid key in JDK_HOME_PATHS exists with JDK<ant_jdk_version>_HOME then that JDK is used.

       3.      If a default JDK is defined in JDK_HOME_PATHS, then that JDK is used.

       4.      If the JDK that will be used is different from the BUILD_TOOL_JDK_HOME, the Java compiler will automatically be forked as a separate process. To determine if the two JDKs are different, the installation paths are compared.

Example

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 the 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.

Prerequisites

The development configuration is imported in the Developer Studio.

More information: Managing Development Configurations

Procedure

...

       1.      Open the development configuration in the Development Infrastructure perspective.

From the menu path choose Window Open Perspective Development Infrastructure. Select the development configuration and open the Component Properties view for the development configuration.

       2.      Under the Overview tab, open the bottom link Technology Specific.

       3.      Configure the JDK options for the development configurations.

Caution

You can choose to use a runtime environment of the Developer Studio that is different from the environment against which you develop your applications. The Developer Studio can run using a JDK/JRE that is different from the AS Java one your development targets. This means that even though your projects may compile successfully when using different versions of the JDK, you may not be able to deploy your application on the AS Java server.

For example, you should not replace the default Java 5.0 facet (it is always a default facet, regardless of the Developer Studio’s JVM) with the Java 6.0 facet. This makes the project JDK 6.0-compatible. Since the AS Java runs on a JDK 5.0-compatible virtual machine, your project will not deploy there. The same is valid if you use the Properties   Java Compiler   Compiler compliance level option to change the project’s JDK compliance to 6.0.

More information:

Build Options

End of Content Area