There are two steps involved in getting NetBeans 8.2 to work:
- Download and install JDK 1.8 if it is not already on your machine:
- This answer describes how to do that for openjdk 1.8 on High Sierra.
- Alternatively, you can download Oracle JDK 1.8. The installation instructions are here.
- Once JDK 1.8 is installed, update the file netbeans.conf:
- Locate file netbeans.conf within the etc directory under the NetBeans installation directory.
- It is a text file containing name/value property pairs. Open it in any text editor.
- One of the properties it might specify is the path to the default JDK to be used via property netbeans_jdkhome. Therefore locate the line containing the text netbeans_jdkhome.
- If line is commented by starting with the # character then delete that character.
- In the unlikely event that the property does not exist in the file at all, just insert it at the end of the file.
- The property's value should be the path to your JDK 1.8 installation.
- In my NetBeans 8.2 installation my entry looks like this
netbeans_jdkhome="C:\Java\jdk1.8.0_181"
, though obviously your path will be different.
- Save your change to netbeans.conf and restart Netbeans. Your issue should be resolved.
Alternatively, if you would prefer to use JDK 11, you could take a completely different approach:
- Download and install Apache NetBeans 10.0 which supports JDK 11.
- Since you already have JDK 11 installed, NetBeans should work immediately.
Notes:
- With NetBeans 10.0, individual projects can be configured to use JDK 8, 9, 10 or 11, provided that:
- The corresponding JDK is installed on your machine.
- The corresponding JDK is also added as a Java Platform within NetBeans (using Tools > Java Platforms > Add Platform...).
- On NetBeans 8.2 you cannot use any JDK version > 8.
- You can safely install both NetBeans 8.2 and NetBeans 10.0, and even run both instances concurrently. They do not impact each other in any way, though obviously you should not open a project in both instances of NetBeans at the same time.