Try this - for temporary
Windows
netbeans.exe --jdkhome "c:\JDK\path"
Unix
netbeans --jdkhome /usr/bin/yourjdk
If you want to set the parameter permanently, you can do this in the netbeans.conf file. and change.
# Default location of JDK, can be overridden by using --jdkhome <dir>: netbeans_jdkhome="c:\your\JDK\path"
source share