Sunday, March 17, 2013

Installation Fortran Java and C++ in Netbeans IDE

The following steps will guide you to install free GNU Fortran (gfortran), C/C++ (g++) and Java (oracle) in Netbeans in Windows7. There are 3 installation parts that you have to do, starting from Part 1, Part 2 then Part 3.

PART 1 - Install GNU Fortran (gfortran) and GNU C/C++ (g++)

Step 1 - Download gfortran and g++ from MinGW

MinGW, a contraction of "Minimalist GNU for Windows", is a minimalist development environment for native Microsoft Windows applications.

MinGW includes GNU Compiler Collection (GCC), including C, C++, ADA and Fortran compilers.

You have to download GUI wrapper (mingw-get-inst) for the command line installer. Select the latest one from here. For example mingw-get-inst-20120426.exe

Step 2 - Install MinGW to your computer

This step will install C, C++, Fortran, MSYS basic system, and MinGW developer tool.

Goto your folder where you saved MinGW installer, and just run it (or double click) to start the installation process. Do not change the default installation folder, so Netbeans path will recognise MinGW.

Make sure you select the required components (C, C++, Fortran, MSYS, and MinGW) when you are requested to select the components.

Step 3 - Add installation path MinGW to your computer

This step will add MinGW installation path to your computer. Netbeans will recognize this path during the activation of C/C++ and Fortran compiler.

To edit your PATH environment variable in Windows:

  • Right click on Computer > Properties
  • Click the Advanced system settings
  • Click the Environment Variable
  • Select Path and click Edit
  • Add (DO NOT REPLACE THE EXISTING VALUE) to the end of variable value, the following paths:

PART 2 - Install Java and Netbeans

Step 1 - Download bundles Java+Netbeans

The bundle of the latest version of  Java+Netbeans can be downloaded from Oracle website. Select JDK + Netbeans
Accept the agreement and start dowloading the bundle installer (-i586.exe for 32bit machine, -x64.exe for 64bit machine).

Step 2 - Install Java+Netbeans

This step will install Netbeans and Java.

As normal installation in Win7, goto the folder where you saved the executable bundle java+netbeans, then run it (or double click) the exe file. Follow all instructions until successfully completed.

Step 3 - Activate C/C++ and Fortran 

Your C/C++ and Fortran have not been activated. The C/C++ plugin must be installed. Although the name is plugin C/C++, it includes Fortran compiler as well. Open Netbeans, from the menu Tools, select Plugins
From the available plugin list, select C/C++. Then click the Install button. This plugin will be downloaded from Netbeans repository.

Step 4 - Setting C/C++ and Fortran paths

Open Netbeans, from the menu Tools, select Options
Select C/C++ tab, then click  Restore Defaults
If the paths cannot be automatically appeared, make sure you do PART-1 Step-3.

PART 3 - Testing your installation works

Step 1 - Fortran Hello Word test

Now you can test your Fortran. 

  • Open Netbeans
  • File > New Project > Select Project >Choose Project - Samples -  C/C++ > Fortran Hello Word Application
         Continue until finish setting the new project.
  • From the project window, select bar.f then Run. You should be able to run your fortran program.
Step 2 - C++ Welcome test

Now you can test your C++. 

  • Open Netbeans
  • File > New Project > Select Project > Choose Project - Samples -  C/C++  > Welcome
  • Continue until finish setting the new project.

  • From the project window, select then Run. You should be able to run your C++ program.

Now you have a powerful programming environment in your computer. You can use Fortran, Java or C/C++. 


  1. i m following the same steps but build fail

  2. Hi Rahul,
    This is tested in Windows 7.
    My friends did not have any problems in Win 7.

  3. Hi Prof was,
    i wanna know. Can Fortran 77 coding (.for) be run through this Netbeans platform??

    1. I think you can compile fortan 77 too..

  4. Can i connect mysql, fortran and java 8? please suggest

  5. This is such a great and informative post about Help Dissertation. I have started my own service in manner of Online solution classes. If you want such type of services then you can get help and services from our company which name is For more info please explore this and share it also.

  6. it was a great article thanks for sharing this interesting information. best sewing machine for leather