Try installing Java 8.
brew tap adoptopenjdk/openjdk
brew cask install adoptopenjdk8
If you end up in Error: Cask adoptopenjdk8 exists in multiple taps:
due to prior workarounds with different instructions, specify the absolute location like this:
brew cask install adoptopenjdk/openjdk/adoptopenjdk8
Once the installation is complete, add JAVA_HOME
to ~/.profile
and source it.
export JAVA_HOME=/Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home
export PATH=$PATH:$JAVA_HOME/bin
To install NetBeans IDE, issue
brew cask install netbeans