3

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.

user1164112
  • 151
  • 2
  • 7
  • you mean you want to compile using `JDK6` and want to run it using `JDK 7` ? – kaysush Feb 18 '13 at 16:11
  • Yes, I want it to be compiled via JDK6 but I want to test running it against Java 6 and Java 7 to make sure there aren't any changes in operation. – user1164112 Feb 18 '13 at 16:19

1 Answers1

5

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.

kaysush
  • 4,797
  • 3
  • 27
  • 47