Java compiler javac
has an option to compile the code to generate compatible bytecode for other platform versions by specifying -target
option. Consult the cross-platform option in Oracle docs for Cross-Compilation Options. If he code compiles with this option then you could run both platform if not then you have to rewrite the Java 7 code to be compilable for the Java 6 platform.
In the Netbeans IDE there should be a project settings where you could change either JDK or language level.