Setting the Target JDK in a Project

See Also 

By default, the IDE uses the version of the Java SE platform (JDK) with which the IDE runs as the default Java platform for compilation, execution, and debugging. You can view your IDE's JDK version by choosing Help > About and clicking the Detail tab. The JDK version is listed in the Java field.

In the IDE, you can register multiple Java platforms and attach Javadoc and source code to each platform. For example, if you want to work with the new features introduced in JDK 5.0, you would either run the IDE on JDK 5.0 or register JDK 5.0 as a platform and attach the source code and Javadoc to the platform.

In , you can switch the target JDK in the Project Properties dialog box. In , you have to set the target JDK in the Ant script itself, then specify the source/binary format in the Project Properties dialog box.

To register a new Java platform:

  1. Choose Tools > Java Platforms from the main window.
  2. Click New Platform and select the directory that contains the Java platform. Java platform directories are marked with a Java platform folder icon in the file chooser.
  3. Use the Sources and Javadoc tabs to attach Javadoc documentation and source code for debugging to the platform.
  4. Click Close.

To set the default Java platform for a standard project:

  1. Right-click the project's root node in the Projects window and choose Properties.
  2. In the Project Properties dialog box, select the Libraries node in the left pane.
  3. Choose the desired Java platform in the Java Platform combo box.

    Switching the target JDK for a standard project does the following:

  4. If you want to register additional Java platforms with the IDE, you can do so by clicking the Manage Platforms button. Then click the Add Platform button and navigate to the desired platform.

To set the target Java platform for a free-form project:

  1. In your Ant script, set the target JDK as desired in the javac, java, and javadoc tasks.
  2. Right-click the project's root node in the Projects window and choose Properties.
  3. In the Sources panel, set the level of JDK you want your application to be run on in the Source/Binary Format combo box.

    When you access Javadoc or source code for JDK classes, the IDE searches the Java platforms registered in the Java Platform Manager for a platform with a matching version number. If no matching platform is found, the IDE's default platform is used instead.

See Also
Managing the Classpath
Declaring the Classpath in a Free-Form Project
Stepping Through Your Program

Legal Notices