1. Introduction

NetBeans is an open-source, cross-platform integrated development environment (IDE) supporting various languages. It offers smart code editing, an integrated debugger, version control, graphic user interface (GUI) design tools, and project management support. Also, NetBeans has an active community and versatility, making it a popular choice for diverse development endeavors.

In this tutorial, we’ll learn how to install NetBeans on Linux.

First, we’ll examine installation methods, including installing using binary packages and the APT repository. In addition, we’ll discuss how to utilize Snap and Flatpak for a more streamlined NetBeans setup. Then, we’ll address the uninstallation of NetBeans using the remove and purge flags in the APT package manager. Lastly, we’ll see how to uninstall NetBeans if we install it using newer package managers.

2. Installing NetBeans

In this section, we’ll discuss most approaches to installing NetBeans on the Linux operating systems.

2.1. Using a Binary Package

To begin with, we can use binary packages to install NetBeans.

Before we download the package, we install the JRE (Java Runtime Environment):

$ sudo apt install default-jre

JRE comprises a set of software components designed for executing Java applications.

Next, we verify its installation:

$ java -version

Additionally, we need to install JDK (Java Development Kit) to compile and run some specific Java-based software:

$ sudo apt install default-jdk

After that, we verify the installation by checking the version:

$ javac -version

Now, we go to the official NetBeans website and from there select Download. After clicking Download, let’s install the latest version available on the website.

Once we click on the latest version download button, we can see different types of files with various types of extensions. We click on the file that contains the .deb extension. For example, we can use the file apache-netbeans_20-1_all.deb.

At this point, we can install NetBeans in the command-line interface. To do so, we use the dpkg command and install the downloaded package:

$ sudo dpkg -i apache-netbeans_20-1_all.deb

Once we execute the above command, NetBeans should be installed.

2.2. Using the APT Repository

An alternative way to install NetBeans is to use one of the default APT repositories. In particular, we leverage the universal repository that houses community-maintained software.

Now, let’s add and enable the repository:

$ sudo add-apt-repository "deb http://archive.ubuntu.com/ubuntu stable universe"

Once we have the repository, we update all package lists using the apt command:

$ sudo apt update

After the package index is refreshed, we can optionally upgrade the system:

$ sudo apt upgrade

Once the system is updated and upgraded, we install NetBeans::

$ sudo apt install netbeans

Once the installation is finished, we can use NetBeans on our system by launching it from the Activities panel.

2.3. Using Snap

Another approach to installing NetBeans is to use Snap.

Snap is a universal packaging system for Linux, simplifying application distribution. It achieves cross-distribution compatibility and enhances security through confinement.

Although it’s available by default on many major distributions like Ubuntu, we can also install Snap, if needed.

Now, let’s install NetBeans using Snap:

$ sudo snap install netbeans --classic

This command installs the NetBeans IDE on a Linux system using the Snap package manager. Additionally, we add the –classic flag to allow this package access to the system resources and directories. This is particularly useful for applications with intricate requirements, such as IDEs, which often need extensive system access to function properly.

2.4. Using Flatpak

Similarly, we can use Flatpak to install NetBeans on Linux. To do so, we first need to install Flatpak.

Once we’ve installed Flatpak successfully, we can now install NetBeans. For this step, we use the install command with flatpak, followed by the package name:

$ flatpak install flathub org.apache.netbeans

In the above command, flatpak installs the Apache NetBeans IDE on a Linux system using Flatpak. It fetches the NetBeans package from the Flathub repository, ensuring secure installation in a sandboxed environment with bundled dependencies.

Once the installation is done, we can view the NetBeans in the Activities panel.

3. Uninstalling NetBeans

In this section, we’ll explore various ways to uninstall Netbean from a Linux system.

3.1. Using apt-get remove

The apt-get command has the remove subcommand for uninstalling a specified package in Debian-based Linux distributions while preserving configuration files.

Now, we uninstall NetBeans using the remove flag with the apt-get utility:

$ sudo apt-get remove netbeans

In the above command, the remove flag is used with the apt-get command to uninstall the NetBeans IDE.

3.2. Using apt-get purge

Similarly, we can use the purge flag to uninstall NetBeans. The purge subcommand removes a package and its configuration files, ensuring a complete and clean uninstallation on Debian-based systems.

To remove NetBeans using purge, we use the package name netbeans:

$ sudo apt-get purge netbeans

The command above uninstalls the NetBeans IDE, removing both the package and its configuration files.

In summary, the apt-get remove command removes package binaries but retains configuration files. On the other hand, the apt-get purge command removes both package binaries and associated configuration files for a thorough uninstallation.

3.3. Using snap and flatpak

Notably, the commands sudo apt-get remove and sudo apt-get purge are specific to the APT package manager and don’t work for packages installed with Snap or Flatpak.

Therefore, we use the same package manager to uninstall an application that we used to install it.

For instance, to uninstall NetBeans that we installed using Snap, we use the snap remove command:

$ sudo snap remove netbeans

Conversely, we use the flatpak uninstall command to remove NetBeans installed using Flatpak:

$ flatpak uninstall neatbeans

Hence, it’s important to employ the correct command corresponding to the package management system that we used for installation.

4. Conclusion

In this article, we learned how to install NetBeans on Linux.

Initially, we examined installation methods, including manual installation, an APT repository, Snap, and Flatpak. Finally, we addressed the uninstallation of NetBeans using the remove and purge flags within the APT package manager.