Java and NetBeans are free. Your computer probably already has a version of the Java runtime (the JRE), but it probably does not have a version of the JDK (Java Development Kit), which you need for NetBeans.
You may want to first remove the Java runtime software from your computer, then install the Java JDK with NetBeans bundle. The bundle installation will install the latest version of Java runtime, the latest version of Java JDK, and the NetBeans development environment all in one step.
You don't have to uninstall the existing version of the JRE. If you leave the existing JRE (Java Runtime Environment) on your computer, and install the bundle, it will install the new version in addition to the old one, and NetBeans will use the new one.