1) Clone the latest source code from the GitHub repository to your local machine:
git clone https://github.com/apache/incubator-netbeans.git
2) Open your terminal and traverse inside of the cloned directory named "incubator-netbeans"
3) Build the IDE using Apache Ant. If you do not have it installed, please download from here: https://ant.apache.org/
To build, simply issue the "ant" command from within the "incubator-netbeans" directory.
4) The build process will take several minutes, as it obtains all of the dependencies and performs the compilation process. Once completed, open the incubator-netbeans/nbbuild directory, and you should see a directory entitled "netbeans". Inside this directory are all of the files required to run the Apache NetBeans IDE. You can run the IDE by invoking the incubator-netbeans/nbbuild/netbeans/bin/netbeans executable.
Once the executable is started, you will be presented with the new Apache NetBeans 9.0 splash screen, and you can then begin to use the latest build.