I came across this situation when I first installed Java 11 and tried with that, due to some reasons I uninstalled Java 11 (JDK 11) and faced the issue.
If you are facing the same issue on NetBeans then in this blog you will find the best answer.
This problem has arisen because right now you must be using a different version of JDK. Make sure you can that out on your C drive: [C:\Program Files\Java]
As you can see, I have jdk1.8.0_191 version right now, that’s why that actual problem arose.
How to Solve NetBeans “Cannot locate java installation in specified jdkhome”?
To solve this actual problem, make sure you edit the NetBeans Config file which is located in the following location;
C:\Program Files\NetBeans 8.2\etc netbeans.cluster netbeans.conf [Edit This] netbeans.import
Note: To edit that file I would recommend you to install editors like Notepad++ or Sublime Text.
Step 1: Copy that file on the desktop and Open it on any above specified editors and search for the following code.
Step 2: Now on that variable “netbeans_jdkhome” you can see Java 11 has been defined. Change that location with the new one that you are currently using; For me, I’m using JDK 8, so I will go with that;
That’s all, you are done solving this specified problem which occurs while using NetBeans for programming;