Netbeans - Build targetting JDK 6 but run using Java 7 JRE
java, netbeans
Solution
Go to the project properties by right clicking on the left hand pane
Build->Compiling
on lower side you will see Additional Compiler options
give the params as `-target 6` and this will compile you code according to `JDK 6` and when you will run the program it will run it using `JRE 7`.
Problem
I'm working on a project where I need to build against JDK 1.6 but I would like to test it against both Java 1.6 and 1.7 - I have both Java 1.6 and 1.7 JDKs installed. I know I can create a new Java Platform for each but that would result in the project being built against JDK 1.6/1.7 as well - I only want it run against both. Is there an easy way to tell Netbeans to build against my JDK 1.6 Platform but run using my Java 1.7 JRE. Or even if there is an option for using an external JRE to run the project with I could make it work.