Cross-Compiling Between Java Platforms

When you compile sources, by default the IDE uses the default compiler and system libraries on which it runs. You may, however, want to compile an application to optimize it for a specific Java platform. In this case, you will want to compile the sources against a specific Java platform's system libraries and possibly using a specific compiler version.

For example, you might be developing an application that is designed to run on JDK 1.3 while running the IDE on JDK 1.4. In this case, you should configure your sources' compiler type to use the JDK 1.3 compiler.

To configure a compiler type to use a specific Java platform's compiler:

  1. From the main window, choose Tools and choose Options.
  2. In the Options window, expand Building and expand Compiler Types.
  3. Select the Compiler Type node for your sources.
  4. In the property sheet, select the External Compiler property and type the path to the desired Java platform's compiler executable. You can also click the ellipsis (...) button to open a dialog box and browse to the compiler executable.

    This change causes the compiler type to use both the compiler and the system libraries of the selected Java platform. The change affects all files and templates that use this compiler type.

You may, however, need to compile an application against an older Java platform without using that platform's compiler. For example, you might need to compile applets against JDK 1.1, but not want to use the JDK 1.1 compiler because of performance reasons. In this case, you should set the compiler type's Boot Class Path property to the desired Java platform while using the External Compiler.

To configure a compiler to use a specific Java platform's system libraries:

  1. From the main window, choose Tools and choose Options.
  2. In the Options window, expand Building and expand Compiler Types.
  3. Select the Compiler Type node for your sources.
  4. In the property sheet, select the Boot Class Path property and type the path to the desired Java platform's bin directory. You can also click the ellipsis (...) button to open a dialog box and browse to the JDK directory.

    This change affects all files and templates that use this compiler type.

See also
Configuring the Compiler
Compiling a Java Program

Legal Notices