What you need to do is specify the source compatibility to something that's supported by both JDKs (<= 1.5). It may make sense to go lower than 1.5 if, for instance the application you're building may be deployed to an environment that only has Java 1.3 installed.
I know this is possible in Eclipse, but unfortunately, I'm not familiar with NetBeans, but I'm sure it would be possible too.
If it's any help, here's how you do it if you're just running javac
from the console (assuming you want 1.5 as your base level):
javac -source 1.5 ...
This is also possible as a plug in configuration within a Maven POM, if you're using Maven (which I understand NetBeans has excellent support for). This is how you'd do that (from http://maven.apache.org/plugins/maven-compiler-plugin/examples/set-compiler-source-and-target.html):
<project>
[...]
<build>
[...]
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.4</source>
<target>1.4</target>
</configuration>
</plugin>
</plugins>
[...]
</build>
[...]
</project>
And as Brian Agnew points out, possible in Ant also.