Make sure you have downloaded and installed Java Development Kit (JDK). It is possible that you have only Java Runtime Envoronment installed, but JDK is not installed on your system.
Next step, uninstall Netbeans you have already installed on your system and navigate to Netbeans Downloads Page
According to your needs, choose Java SE
, Java EE
or All
option on this page and download the installer.

As you have downloaded the installer, launch it and make sure that Java support is included to the installation options.

In case you want to customize installation options, use the Customize
button, shown on the picture above.
Just make sure, that you have enabled Java SE (Java Standard Edition) support.