NetBeans Tutorial – Getting started With NetBeans IDE For Java

A comprehensive guide to Java NetBeans IDE including its features, how to download and install NetBeans on Windows 10 and Linux:

NetBeans is an open-source, Integrated Development Environment (IDE) that is developed in Java and is used to design, debug and deploy software applications that run on desktop, web, and mobile.

NetBeans editor supports Java, JavaFX, JavaEE, Java ME, JavaScript, HTML5, Python, PHP, Groovy, XML, C, and C++ languages and is compatible with Windows, Linux, Unix, and macOS, Android, iOS Operating system.

Getting started with NetBeans IDE for Java

Java NetBeans IDE

It is an IDE that supports designing Java desktop applications by constructing various program constructs using its GUI. We also use it as a GUI builder that uses Java Swing API with drag-and-drop features.

In addition, it helps in debugging the code, unit test the functionality, import already developed programs using other GUIs like Eclipse, JBoss, etc, and export developed Java program for the developers to integrate using GIT and subversion.

We have used Apache NetBeans IDE 12.0 in this tutorial.

Benefits And Features Of NetBeans

NetBeans IDE offers the following features:

  • Support for Ant and Maven, a build automation tool for Java projects.
  • Works with version control systems like GIT, Subversion.
  • Design, test, debug, deploy all Java programming platforms.
  • Text Editor for HTML5, Java, JavaScript, Ruby, PHP, Python, CSS, C, C++ languages.
  • Can be installed on Windows, Linux, Unix macOS, Android, and iOS operating systems.
  • Support for Glassfish, Tomcat, and Java EE Servers.
  • Build-in assistance that offers auto-suggestion and completion during code generation.
  • Drag and drop features for Swing and AWT controls, containers, menus, and Windows.
  • Integration with JUnit and TestNG frameworks for Unit testing.
  • Cross-platform support, quick GUI builder with the drag-and-drop feature.

Prerequisites: The system should have JDK 1.8 or higher installed in order to install NetBeans IDE

Also Read =>> Eclipse Vs NetBeans: Comparing Best Java IDEs

NetBeans For Windows: Download And Installation

Installing Java JDK for Windows

#1) Enter URL in browser’s address bar. It opens a download page for JDK as shown in the image below, where the Java SE Downloads button is tagged as 1.

#2) Click on Java SE Downloads button. It opens a page that has an Oracle JDK label. Click on the JDK Download link tagged as 2 in the image.

#3) The Download link for JDK will open a page with two options, tagged as 3 in the image.

  • Windows x64 Installer i.e. jdk-15.0.1_windows-x64_bin.exe
  • Windows x64 Compressed Archive i.e.

#4) Click on jdk-15.0.1_windows-x64_bin.exe, tagged as 4 in the image to download it. You can locate the Download folder by clicking Ctrl + J for Google Chrome. Double click the executable file tagged as 5 in the image and follow the instructions to install JDK on your machine.

Once JDK has been installed, you can verify successful installation by typing the java -version in the command line. It will display an installed version of Java as well as JRE details.


Installing NetBeans

#1) Enter URL in browser’s address bar. This will open a page that displays a download button for Apache NetBeans 12 LTS (NB 12.0). On the download page, you will find binaries (previously compiled source code in .exe format) and installers that contain binaries and other resources that help the installation and setup of NetBeans IDE on the system.

It is advisable to check the system configuration and its compatibility before installing any software. In order to check system configuration, select the Computer icon on the desktop, right-click, and select properties. This will open a window that displays System type under the System heading. In this case, it is Windows 7 of Type 64- bit Operating System.

#2) Click on Apache-NetBeans-12.0-bin-windows-x64.exe under Installers to download NetBeans IDE. Once downloaded, you will find an executable file. Double click to install it on the system. Accept the license and follow the further steps to complete the installation.

netbean download

Upon clicking on the desktop icon for NetBeans IDE, it opens an interface that displays menus and icons. File, View, Debug, Profile, Team, Tools, Window, Help are all the menus, whereas icons are as follows:

  • New File (Ctrl + N)
  • New Project (Ctrl + Shift + N)
  • Open Project (Ctrl + Shift + O)

NetBeans For Linux: Download And Installation

Installing Java JDK for Linux

Follow the same steps #1 and #2 of Installing Java JDK for Windows section.

Locate Linux x64 Compressed Archive, having file ending with Linux-x64_bin.tar.gz. (Archive binaries) tagged as 3 in the image. Download the file. Open terminal, go to the download location, and unpack the downloaded archive binaries file by entering the command below:

$ tar zxvf jdk-15.0.1_linux-x64_bin.tar.gz


  • tar is the command to extract tar files from tar.gz archive.
  • z means (un)zip the zipped file in Linux.
  • x means extract files from the archive.
  • v means to print or display the filenames verbosely.
  • f means the following argument is a file name.

Next type the command:

chmod jdk-15.0.1_linux-x64_bin

Here, chmod is a Linux command to modify access permissions of files and directories.

Execute the downloaded file with the following command to install NetBeans on Linux operating system.

./ jdk-15.0.1_linux-x64_bin

Type java -version command to confirm successful installation of JDK on Linux environment.

Installing Java JDK for Linux

Installing NetBeans for Linux

#1) Go to page. In order to check the system configuration and its compatibility before installing any software on Linux, open the terminal and type the following command:

uname -a

It will display x86_64 for 64 bit Linux OS type.

#2) Select Installer –

Open terminal (by clicking Ctrl+Alt+T),

Verify access permission by typing chmod +x

#3) Finally type the following command to install NetBeans IDE on the Linux system.


Installing NetBeans for Linux

Understanding User Interface Of NetBeans

NetBeans IDE has a very clean and easy to navigate user interface divided into the following sections:

NetBeans IDE interface

#1) Title Bar

It is the topmost section that displays the name of opened interface, file, or project that is open at that instance. By default, it displays the heading as Apache NetBeans IDE <version>.

#2) Menu area

It is the next section placed below the title bar, which contains commonly used features grouped as submenus under menu items.

Menu items displayed are explained below:

  • File has the following features:
    • Creation of new project or file
    • Save newly created project or File, Save As (save in required format), Save All saves all the changes made in all the opened interfaces
    • Open one or multiple existing or recent project(s), file(s)
    • Import project created in Eclipse IDE or zipped file
    • Export designed project into a zipped folder
    • Close All project(s) OR file(s)
    • Page setup, Print code contents that display in Editor area
    • Exit NetBeans IDE
  • Edit has modification features like,
    • Undo, Redo the previous step or action(s)
    • Cut, Copy, Paste or Delete section of text content
    • Select All the content or identifier (object, letters, digits, underscores, etc)
    • Find particular text from the code content
    • Replace the text with some other text
    • Creation of macros to perform some actions using Start Macro Recording

file and edit features

  • View display various interfaces like,
    • IDE logs, Toolbars (displaying icons for features like file, clipboard, Undo/Redo, into the toolbar)
    • Display/Hide various sections in code
    • Change into Full-Screen mode that displays View and Editor area
  • Navigate display Go options
  • Source helps to move across the code
  • Refactor has renamed, move, copy or safe delete created entities
  • Run to execute, test, build, clean, and build project or file
  • Debug checks and detects a portion of code for error
  • Profile shows basic JVM monitoring, CPU, memory, SQL queries profiling, threads, locks
  • Team displays source code management with any one of the versioning tool from Git, subversion, or mercurial
  • Tools for internationalization, add Java platforms to register other versions, add JAR, libraries, add servers like Tomcat, Glassfish, remote cloud selection like Amazon, palettes like AWT/Swing components, HTML/JSP code clips, include Plugins, various options to select from.
  • Window allows opening or moving to various interfaces for a project, files, favorites, services, navigator, action items, tasks, output, editor, debug, profiling, web, and other windows
  • Help display online support and documents, keyboard shortcuts, check for any software updates, opens start page, finally default configurations of NetBeans using About.

#3) Toolbar

This is a section that appears below the menu area, where quick access icons, buttons are placed. It displays New File, New Project, and Open Project icons when you open NetBeans first time. You can display or hide icons in the Toolbar, by selecting View –> Toolbars, and various feature titles listed in the submenu.

  • Selecting File will display New File, New Project, Open Project, Save All icons in the Toolbar
  • The toolbar will display Cut, Copy, Paste icons when Clipboard is selected.
  • As the name suggests, Undo/Redo in View toolbar will display Undo and Redo icons
  • Run submenu from View->Toolbar will display following icons
    • Build Project
    • Clean & Build Project
    • Run Project
    • Reload
    • Debug Project
    • Profile Project
  • Debug submenu under Toolbar lists the following icons
    • Finish Debugger Session
    • Pause
    • Continue
    • Step Over
    • Step Over Expression
    • Step Into
    • Step Out
    • Run to Cursor
    • Apply Code Changes
    • Toggle Pause in GraalVM script
    • Take GUI snapshot
  • Clicking on the Performance submenu under Toolbar display memory toolbar that displays current memory being consumed/total available memory. By clicking the button, we reclaim memory from unused objects from Java programs with the garbage collection feature of JVM.
  • There is Git support–a file versioning software integrated with NetBeans. This can be utilized by selecting Git from View -> Toolbar, which allows the following actions to be carried out.
    • Show Annotations
    • Show History
    • Revert Modifications
    • Commit
    • Show Changes
    • Diff to HEAD
    • Pull from Upstream
    • Fetch from Upstream
    • Pull
    • Fetch
    • Pull
    • Push to Upstream

#4) View area

View Area displays various windows that are used for specific purposes.

In order to access/open these interfaces, select the Window menu and check the list as displayed in the image below:

Activate various windows using Windows menus

  1. Projects interface gets activated on selecting Project from Windows menus, OR by selecting Ctrl +1 using shortcut keys. Right-clicking inside this window can access various features inside this window. These include Create New Project, Create New File, Open existing Project, Recently opened Project, Build the Project, Clean and Build the Project, Run the Project, Debug the Project OR display Java Packages in as Tree or List.
  2. Files window displays the list of files that are being worked on and are listed as integrated into the project by collapsing them, as well as displaying specific nodes with different Project Owners. Shortcut keys for accessing the Files window is Ctrl +2
  3. Favorites window displays a list of files as a favorite that comes from the local file directory for the user to work with. The shortcut key for accessing the Favorites window is Ctrl+3.
  4. Services window displays various types of folders that help users to connect directly with Databases, Web Services, Servers, Cloud, Docker containers, etc. Shortcut keys to access the Services window is Ctrl+4
  5. Navigator window display compact structure and helps navigation of files like source file build files, libraries, configuration files, etc. of a project in a hierarchical manner, Ctrl+7 is a shortcut key to access Navigator Keys.
  6. Action Items, when selected, validates your code by scanning it for commented lines with words TODO or FIXME, style warnings, compilation errors, and quick fixes. The shortcut key for the Action item is Ctrl+6.
  7. Tasks Window performs various functions like creating a local task, locate tasks, and execute pre-defined tasks per schedule like debugging the code, compiling the code, or running an application. The shortcut key for Task is Ctrl+Shift+6.
  8. Output window displays console output, the status of compilation, build status, compile-time, and execution time errors. The shortcut key for the Output window is Ctrl+4.

#5) Editor area

Editor Area displays code that allows developers to design programs, that contain variables, methods, analyze, change or edit code in case of compile-time or runtime errors. NetBeans IDE uses shortcut keys or a toolbar that quickly creates code.

NetBeans IDE Tasks

Various tasks that can be accomplished using NetBeans IDE are explained below:

Creating a new Java Project:

There are various ways you can quickly create a new Project, These are:

  1. You can right-click under the File window that can be selected using Ctrl+2 and select the New Project submenu.
  2. Click on the 2nd icon that is displayed in the Toolbar area that opens by selecting View – Toolbars – File.
  3. Using shortcut keys Ctrl+ Shift+ N.

Open a window with the title New Project. There is 2 steps selection: Categories and Projects tagged as 1 in the image below. Categories include Java with Maven, Gradle, or Ant options that builds, tests, and deploys software projects on several platforms. Projects is selected as Java Applications. 

The next step, tagged as 2, in the image below, is a window that lets you enter the Name, location, and folder for Project in the window. After entering the details, click Finish. This will create a new Java Project that can be seen under Projects window of View area of NetBeans.

Categories and Project

You can open projects already developed by accessing the submenu Open Project under the File menu. Open Recent Project submenu will list recently opened/designed projects. You can select the project name that opens in the Projects tab.

Using File – Import Project – Eclipse Project, help import of Project developed using Eclipse from its workspace location. Select Project to import and click the finish button. This will show the project and associated files in the Projects tab.

You can export Project by selecting File – Export Project – To zip. This will convert the completed project into a zipped folder that can be sent for implementation on the client-side.

Creating Java Class:

Right-click at Java Project and selecting New – Java Class.

Enter Java Class name in File Name text field. The name of the Project is displayed in the Project text field. Click on the Finish button tagged as 1 in the image. This creates Java Class in the Editor area that also displays code for the class as shown in the image below tagged as 2.

Creating Java Class

Entering the main method in Java Class:

Click on the Tools menu and select Options submenus. This will open a window with the title Options. Select the Editor tab, click on the Code Templates section.

With Java language being selected, select abbreviations psvm under Templates window. It will display Extended Text, which displays complete syntax for the main method,i.e. public static void main (String [] args) { } as seen in the image below.

Entering the main method in Java Class

Adding getter and setter in Java Class:

  1. Select a Class name in the editor area using a mouse and right-click. Then select Insert Code OR shortcut keys ALT+ Insert.
  2. This will open a drop-down list with Generate title as displayed in the below image. Select Getter and Setter.
  3. A window will open with the title Generate Getters and Setters, displaying variables with radio buttons. Click on the Select All button, which selects all the check boxes besides variables. Click Generate button.

Steps to generate Getters and Setters

The below image shows the auto-generated get and set methods to encapsulate sensitive data:

Auto-generated get and set methods

Importance Of Debugging

It is required to identify shortcomings when code does not produce the expected value or function does not behave as expected. The debugger allows marking breakpoint at a particular line in your source code, step through the method, take snapshots and monitor execution.

Few terminologies used in debugging are:

  • Breakpoint: Execution of program is expected to pause at a particular line of code known as a breakpoint, which can be selected in the NetBeans editor area. Right-click & select Toggle Line Breakpoint OR use shortcut keys Ctrl+F8 after selecting breakpoint.
  • Continue: The execution of the remaining program code will continue starting from breakpoint till the next breakpoint using shortcut key F5 OR by selecting Continue under Debug menu.
  • New Breakpoint: Additional breakpoint can be configured/marked using shortcut key Ctrl+Shift+F8. This opens a window that allows the developer to select the type of breakpoints like Method, Class, Exception, Line, Field, or Thread to Stop execution (at entry, exit, or both) of selected breakpoint type, any action that can be taken on this breakpoint.
  • Watch Windows: How data is handled with a variable can be seen by applying the Watch window using short keys Ctrl+Shift+F7 after selecting a particular variable.

Debug Project

You can debug the Java project, which includes all the codes, functions, variables, methods, etc. to analyze the movement of data across the variables and methods and expected output as well as any deviation that results in an error or unexpected behavior.

Debug icons and their meaning:


You may select one or multiple breakpoints in the code displayed in the editor area of NetBeans IDE and then with anyone option listed below such as

  • Right Click at Project Name under Projects tab, and select Debug
  • Select Debug from the menu bar and select Debug Project
  • Press Shortcut keys Ctrl+F5.

This will open the Output window that executes the code in the program until the first breakpoint,

Clicking the Continue icon or clicking F5 will start the execution of the remaining code until the next breakpoint. There are various analyzes that can be done using Step Into, Step Over, Pause, Finish Debugging sessions.

Clicking on the Step Into icon or clicking F7 will analyze the method and display the variable’s value without putting print statements.

Clicking on Step Over icon or clicking F8 will execute the constructor or method without step into them, whereas the Step Over Expression icon or clicking Shift+F8 will test/debug the expression and display the method call value in that expression.

Pause icon will stop the execution, Click the Step Out icon, or clicking Shift+F7 to come out of the method call after its inspection.

Run Java Project

After debugging/testing the code to verify that the program produces the expected output, you can run by right-clicking at Project and selecting Run As Java Application, for standalone applications.

Building A Project And Creating JAR File

Clean and Build will delete build artifacts whereas Build retains artifacts like .class files.

Building a Project means

  • Build and dist folders are added to the PROJECT_HOME location
  • All java files are compiled into .class files and saved in PROJECT_HOME/build folder
  • Java Archive file that contains Java project is created in PROJECT_HOME/dist folder
  • All the libraries associated with Project are copied into dist/lib
  • Updates manifest file in JAR to designate main class or libraries on project’s classpath.

FAQs On NetBeans IDE

Q #1) Do we have a platform-independent NetBeans IDE installer?

Answer: Yes, it is possible to install NetBeans IDE that can be installed on any platform.

  • Go to the download page of NetBeans IDE.
  • Select OS independent zip from platform drop-down at top right corner.
  • Download the installer and extract the zip folder, go to NetBeans/bin/ folder and install using the installer.

Q #2) How to access Java Docs in NetBeans IDE?

Answer: You can access Java Documentation multiple ways from the Menu area

  • Select Window: IDE Tools – JavaDoc Documentation. This will open a Javadoc tab and will display documentation about the Java element in it.
  • Select Source: Show Documentation
  • Select Help: JavaDoc Index Search OR short key Shift+F1, will display a search text box where you can type in any Java keyword or reserved keywords, and click on the Find button.

Q #3) How to set auto-suggest for Java code help in NetBeans?

Answer: In order to set auto-suggest that pop up suggestions for Java identifier:

  • Go to the menu area, select Tools–Options. This opens a window.
  • Select Editor Tab, select Code Completion tab, and select Java as Language from the drop-down.
  • Select Auto Pop up on Typing any Java Identifier option by checking the checkbox.
  • Click the Ok button.

In Code enter any Java Identifier say, String or Int or Name of Class, etc. IDE will display auto-suggestion.

Q #4) How can I import my Projects developed using IDEs other than Eclipse?

Answer: You can import easily import projects developed in IDEs other than eclipse, using Ant OR Maven build tools, as NetBeans supports Ant and Maven build tools.

Q #5) How to install plugins in NetBeans IDE?

Answer: You can integrate plugins in NetBeans IDE using the following steps:

  • Select Tools from the menu area, click on Plugins. This opens a window with the title Plugins.
  • Select the Settings tab, click on Add button that opens another window where you can enter the name of the plugin and the URL of the server location where the plugin mentioned is available.

When plugins are detected, it will list them in the Available Plugins tab. Click on the Install button to install these plugins. Restart NetBeans IDE.

Q #6) How Java AWT is used to develop Java GUI applications using NetBeans IDE?

Answer: You can quickly design a Java GUI application with the help of NetBeans IDE by right-clicking at Project – New – selecting the JFrame Form option. This creates Frame in Java Editor and opens the Palette tab, displaying Swing containers, controls, and AWT elements, which can be selected and dropped onto Frame form.


NetBeans IDE is used mainly for design, debug and deploy Java-based applications with built-in support for Ant and Maven build tools, easy to integrate with Glassfish, Tomcat, and Java EE servers.

In this tutorial, we covered NetBeans IDE installation on Windows and Linux environment, understood all the menus and features offered by NetBeans IDE’s user interface, steps and shortcut keys in design various programs, import as well as export projects, explained steps to debug the project.

In addition, frequently asked questions related to NetBeans IDE have also been answered.

Further reading =>> How to use NetBeans to make Java apps