First you have to install OpenJDK 8 because Netbeans doesn't work with OpenJDK 11 which is installed on Ubuntu 18.04 by default.
sudo apt-get install openjdk-8-jdk
Next download here the Netbeans installer of your choice for Linux. If you chose Netbeans IDE Java SE you should get the file: netbeans-8.2-javase-linux.sh.
Now start the installer, setting --javahome to the location of OpenJDK 8 (in our case /usr/lib/jvm/java-8-openjdk-amd64/):
bash Downloads/netbeans-8.2-javase-linux.sh --javahome /usr/lib/jvm/java-8-openjdk-amd64/
When the installer asks for JDK for Netbeans IDE, again enter the location of OpenJDK 8 (/usr/lib/jvm/java-8-openjdk-amd64):
That's all. After finishing the installation you will have a Netbeans icon on your desktop which you can double click to start the Netbeans IDE. Alternatively you can start Netbeans with:
Also you could have run the installer as "sudo" so you would have an installation that could be used by all users.