Note: NetBeans should work with the most recent, stable, build of openjdk as well

Ensure JDK is installed correctly

Open up a command line and run the following:

java --version

You should see the version print out. If not, make sure you followed all steps correctly.
(If the Linux manual install isn’t working, consult Oracle’s help pages)

Installing NetBeans

On the NetBeans download screen, select the correct operating system from the drop-down in the upper right. Choose the version with ‘All’. It’s a good idea to select the default install location and packages.

Note: For Foundations 1 and 2 you will primarily be working in C/C++. If you don’t have a lot of space or have a slow connection, you may download just the C++ version for your OS.

After installing NetBeans, you will have to activate the C++ tools. Go to the Tools menu, and open the plugins dialog window. From there, select the Installed tab, and activate the C++ module.

Installing the C++ compiler

In order for NetBeans to compile and run your C++ programs, you must also have a C compiler, C++ compiler, make utility, and GDB debugger.

For Windows: You need to download and install a program called Cygwin in 32 or 64 bit depending on your computer type. During the install a list of all the available packages will appear for you to download. Click the “+” next to “Devel” to expand a list of packages. Click the “skip” label next to the following packages to select them for install: “gcc-core”, “gcc-g++”, “gdb”, and “make”. Click next and the required four packages should be installed under C:\cygwin by default.

Add the Cygwin directory to your system path variable by going into Start > Settings > Control Panel and click “system”. (You can also do this by searching “Env” in the Start Menu. Go to the advanced tab and open Environment Variables. Under the second label titled “System Variables”, select “Path” and then click edit. Add the location of the Cygwin bin folder from where it is installed (usually C:\cygwin\bin) to the list of variables and save it. Once this step is completed, Netbeans should automatically detect and use the compiler. You should now also be able to compile C and C++ code directly from the windows command prompt using commands “g++” and “gcc”.

If after following all instructions carefully NetBeans still isn’t working, try restarting NetBeans and/or your computer.

For Mac: Install Xcode from the Mac App Store (you will need an Apple account), then open Xcode, go to Xcode -> Preferences, then the Downloads tab, next to Command Line Tools click install.

Note: the latest version of Xcode does not install the C++ compilers by default. You must select it manually. It is classified as a ‘optional component’/’command line tool’

A strange problem that might be encountered: sometimes, you run your first C++ program and while it compiles and runs fine, the IDE is still showing multiple errors, especially on the libraries. Google has several different solutions, but one thing you should try first is going to NetBeans > Preferences > C/C++ > Build Tools and click “Restore Defaults”. If the errors are still showing after you click into the code file, go back to the C/C++ menu, click “Project Options,” and check “Show binary files in Project view.” This should remove any corrupted configuration entries and fix the problem.