How to set and use different JDK versions in NetBeans (5.x)

A co-worker of mine asked me ...

"if I want to try various versions of JDK, how do I tell NB to use a particular version of JDK for compiling my sources (or run the class files for that matter..) ?"

For NetBeans 5.x, there's two answers to the question :-)

It depends on the NetBeans Project.

If it is not a free-form Project it is very easy :-)   You simply right click on the project name in the Project Windows and select Project Properties..  Then in Project Properties window, click on the Libraries node in the left panel.  In the right panel you will see "Java Platform:" label, followed by a drop down list and a "Manage Platforms" button. Click on the "Manage Platforms" button to launch the Java Platform Manager window. Click on the "Add Platform" button, traverse the directory structure to find your additional JDK platform.  You can add as many as you like. After adding your additional JDK platforms, click "Finish" / "Close" to return back to the Project Properties window.  In the Project Properties window, you can now select the additional JDK platforms from the "Java Platform" drop down list.  The one you select and press "Ok" will be the one NetBeans will use for you project.  You can also add JDK platforms by selecting Tools > Java Platform Manager from the main menu.  But, you change the default JDK in the Project Properties.

For free-form projects, you have to set the target JDK in your Ant script, (most Ant scripts pick up the target JDK by looking at the JAVA_HOME environment variable.

Also for free-form projects, to configure the IDE to show the correct JDK's classes for code completion, Javadoc documentation, and source files, you must register the JDK in the Java Platform Manager dialog box.

Powered by ScribeFire.

Comments:

Post a Comment:
Comments are closed for this entry.
About

charliebrown

Search

Top Tags
Categories
Archives
« July 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
  
       
Today