Learn how to integrate, open and use a terminal directly in NetBeans.

How to configure an Integrated Terminal (command prompt) in NetBeans for Windows

The developers are usually lazy, we write scripts to automatize all of our tasks in order to skip them or integrate everything in a single place to don't necessarily do it in multiple places. One of those tasks is for example, the usage of the command line while you work in a project. Is very tedious for some developers to be working with the command line and another window for the IDE. A lot of development environments integrate a command line directly in the coding window, so you won't need to leave your ide to run some commands on the terminal. NetBeans is not the exception, however in Windows not everybody knows how to use and that's why we'll teach you in this article how to use the cygwin based terminal directly from the IDE.

1. Install Cygwin

Cygwin is a large collection of GNU and Open Source tools which provide functionality similar to a Linux distribution on Windows. With the installer you will have available a DLL (cygwin1.dll) which provides substantial POSIX API functionality. NetBeans requires Cygwin in order to simulate a terminal in Windows. You can install Cygwin through an MSI installer that is available for 32bits and 64bits versions. For more information about Cygwin, please visit the official website here.

Note

During the installation of Cygwin NetBeans must be closed, otherwise when the installation finishes, NetBeans won't recognize immediately Cygwin. If you install Cygwin while NetBeans still open, restart it and everything should work as expected.

2. Open and use Terminal

Now that you have Cygwin installed on Windows, netbeans won't throw an alert that Cygwin needs to be installed and the Terminal can be started. You can open the terminal inside a project by simply selecting it in the project explorer, then going to Tools and finally clicking on Open in Terminal:

NetBeans Open Terminal

This will start a new terminal window in the bottom of NetBeans where the root path will be set as the path of the project that you selected in the Project Explorer:

Netbeans Terminal Demo

The terminal has available all the windows commands as well but implements an "unix" environment thanks to Cygwin where you can use commands like clear, mkdir etc.

Happy coding !


Senior Software Engineer at Software Medico. Interested in programming since he was 14 years old, Carlos is a self-taught programmer and founder and author of most of the articles at Our Code World.

Sponsors