I had the same problem I installed NetBeans 8.2 on macOS High Sierra, and by default settings, NetBeans will work with the latest JDK release (currently JDK 9).
What I did was forcing NetBeans to use JDK 8, you must config your netbeans.conf
file, you can find it on:
/Applications/NetBeans/NetBeans 8.2.app/Contents/Resources/NetBeans/etc/netbeans.conf
You need to uncomment and update your path to JDK, you will find yours at:
/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home
Just save it, restart NetBeans and you are done!