Running Java6 in Eclipse

How to add java 6 as the default JDK in Eclipse on our NetBSD computers

Start up eclipse and go to Window -> Preferences window. Click on "Installed JREs" under Java in the left hand panel of the Preferences window. (As shown below)

Eclipse installJRE.jpg

Click Add and "Standard VM" in the new "Add JRE" window then click next.

In the "JRE home" box type /usr/pkg/java/jdk-1.6.0 Eclipse should automatically find the JDK and list all the JRE system Libraries

In the Default VM Arguments box add -Djava.net.preferIPv4Stack=true

Eclipse AddJRE.jpg



Click Finish and make the newly installed JRE the default by clicking on the little box next to its name in the "Installed JREs" window.

Now click OK and we are finished. In future any new projects will now use JDK6 by default.

If you have any existing projects where you want to change what JDK it is using, right click on the project name in the "Project Explorer" panel.
Pick "Properties" in the menu and "Java Build Path" in the new "Properties" window.
Choose Libraries in the the right hand panel.
Now choose the JRE system library and delete it.
Click add library then "JRE System Library" and click on next in the "Add Library" window.
Choose the JRE you want and click Finish

Eclipse defaultJRE.jpg



The only other thing you may want to do is to change your default compiler compliance level to 1.6 but this is not necessary. You do this in Preferences - Java - Compiler window