Changing the Target JDK for a Free-Form Project


If you want to set a target JDK for your project that differs from the JDK that the IDE is running on, you must specify the JDK version in both of the following places:

  • The Ant script for any pertinent tasks, such as javac. This ensures that the build targets (and the IDE commands that call them) work correctly.

  • The Project Properties dialog box for the project. This ensures that IDE-specific functions, such as code completion and the Javadoc popup, work correctly.

For the javac task, you could do this by including the source and target options when you call javac. For example, the call to the task might look something like the following example. The javac.source and javac.target properties would need to be specified elsewhere in the script or in a .properties file with the values set to the appropriate JDK version (for example, 1.3, 1.4, or 1.5).

  <javac srcdir="${src.dir}" destdir="${classes.dir}"           debug="true" source="${javac.source}"           target="${javac.target}"       <classpath ref/>   </javac>


To change the target JDK in the project's properties:

  1. In the Projects window, right-click the project's node and choose Properties.

  2. In the Project Properties dialog box, select the Java Sources node and select the target JDK from the Source Level combo box.

If you want code completion and other Source Editor features to work exactly according to the target JDK, make sure that you have the target JDK on your system and registered in the IDE. Choose Tools | Java Platform Manager. If the JDK version that you want to use is not listed in the Platforms list, click Add Platform and navigate to the folder for the JDK that you want to use.




NetBeans IDE Field Guide(c) Developing Desktop, Web, Enterprise, and Mobile Applications
NetBeans IDE Field Guide(c) Developing Desktop, Web, Enterprise, and Mobile Applications
ISBN: N/A
EAN: N/A
Year: 2004
Pages: 279

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net