Just beware when you compile your application using your own customize build file in netbeans(Ant task).
Ant task compile your source using jdk which sit as default jdk in your netbeans platform manager, not the jdk set in your project properties.
To force ant task compile source using your preferred compiler, there are 2 way I found as below :
- Change your netbeans default jdk (if there is more than 1 jdk present in your netbeans platform manager)
Change the value of netbeans_jdkhome to your intention jdk home in netbeans.conf which locate in<NETBEANS_HOME>etc folder.
eg : netbeans_jdkhome=”C:Javabeajdk150_12″ - Set the executable and fork attribute in your Ant task (your customize build file).
eg :<javac srcdir="" destdir="" executable="path-to-java14-home/bin/javac" fork="true" taskname="javac1.4" />