How to install NetBeans IDE on Ubuntu 20.04

NetBeans IDE (Integrated Development Environment) is a very powerful software development tool, mostly used to develop Java and C/C++ applications. It can be used to develop Desktop, Web, and Mobile applications using a modular framework. Using various extensions or plugins, you can add support for other programming languages such as C, C++, HTML, PHP, JavaScript, JSP, Ajax, Ruby on Rails, etc. It supports several features like other IDEs including error checking, code completion, built-in debugging support, syntax highlighting, etc.

In this article, I will show you how to install NetBeans IDE 12 on Ubuntu 20.04 using the command line.

Installing NetBeans Prerequisites

Before starting the NetBeans installation, you require to install Java OpenJDK packages as a prerequisite on the Ubuntu system. For installing Netbeans, you are required to install Java development tool kit JDK version 8 or later on Ubuntu 20.04 distribution. So first, update the system apt packages by running the below-mentioned command:

$ sudo apt update

Now, install the default Java JDK version 11 that is available in the official apt repository of the Ubuntu 20.04 system as follows:

$ sudo apt install default-jdk

Installation of Java OpenJDK

Press ‘y’ and then hit ‘Enter’ to ignore the confirmation prompt. Then, the installation of the Java OpenJDK will complete on your system in a few minutes. 

Once completed the installation, verify the installation of Java JDK and check the installed version by running the below-mentioned command:

$ java --version

As you can see in the below-given screenshot, the default java version OpenJDK 11 has been installed on this system.

Display Java version

Installing Netbeans IDE on Ubuntu 20.04

Once all the NetBeans required dependencies are installed on Ubuntu 20.04, move to the installation of NetBeans IDE on Ubuntu. There are following different ways are present to install Netbeans IDE on Ubuntu 20.04 system:

  1. Install Netbeans IDE using Ubuntu apt repository 
  2. Install Netbeans IDE by downloading the archive source code 
  3. Install Netbeans IDE using snap 
  4. Install Netbeans IDE by installing the script 

In this article, we will only discuss three methods that are most commonly used for NetBeans IDE installation. 

Method 1: Install NetBeans IDE using Ubuntu apt repository

The simple and easiest method to install NetBeans IDE via the Ubuntu apt repository. Through this method, the older version NetBeans 10 installs on your system. Implement the below-mentioned steps to install NetBeans IDE using Ubuntu apt repository:

Step 1: Add Ubuntu universe repository

Add and enable the universe repository via the following command:

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

Add Ubuntu Universe Repository

Step 2: Update Ubuntu apt packages list

After adding the universe repository, update the packages index by running the below-mentioned command:

$ sudo apt update

Step 3: Install NetBeans using apt

Install the NetBeans on Ubuntu 20.04 by using the apt utility:

$ sudo apt install netbeans

The installation will start on your system and can take a bit more time depending on the internet connection speed.

 Installing netbeans IDE using Ubuntu apt repository

Once the installation is finished, you can use NetBeans on your system.

Method 2: Install NetBeans IDE by downloading the archive source code

Using this installation method, you can install the latest Netbeans version 12 on your system. Or you can download the latest available NetBeans version manually from the official apache netbeans website. Follow the following number of steps to install netbeans using the source code method:

Step 1: Download the netbeans archive

Issue the below-mentioned ‘wget’ command to download the latest version of Netbeans 12 archive the on Ubuntu 20.04 system:

$ sudo wget https://downloads.apache.org/netbeans/netbeans/12.4/netbeans-12.4-bin.zip

Download netbeans archive using wget utility

Once the zip archive is downloaded, verify the file download process by running the below-mentioned command:

$ ls

Step 2: Extract NetBeans zip archive

Extract the netbeans zip file on your system by using the following terminal command:

$ unzip netbeans-12.4-bin.zip

 unzip netbeans archive using unzip command

Again, list the created directory content for verification as follows:

$ ls netbeans

List netbeans directory contents

Step 3: Adjust NetBeans files PATH 

Move the netbeans directory to /opt by running the below-mentioned command:

$ sudo mv netbeans/ /opt/

 Move netbeans directory to /opt/ location

The executable netbeans binary is located at the ‘/opt/netbeans/bin/netbeans’ path. So, adjust the $PATH environment variable for the NetBeans files. Open the ‘~/.bashrc’ file in any source code editor tool:

$ sudo nano ~/.bashrc

 Paste the given path at the end of the file as follows:

export PATH="$PATH:/opt/netbeans/bin/"

 Adjust $PATH for netbeans files

Now, source the file via the following command:

$ source ~/.bashrc

Step 4: Create desktop launcher for Netbeans IDE 

Now, create the desktop launcher for NetBeans IDE. For that purpose, you will create a file at the given location by typing the following command as follows:

$ sudo nano /usr/share/applications/netbeans.desktop

 Paste the following lines inside the file:

[Desktop Entry]
Name=Netbeans IDE
Comment=Netbeans IDE
Type=Application
Encoding=UTF-8
Exec=/opt/netbeans/bin/netbeans
Icon=/opt/netbeans/nb/netbeans.png
Categories=GNOME;Application;Development;
Terminal=false
StartupNotify=true

Creating desktop launcher of netbeans IDE

Save the above configuration and close the file.

Step 5: Launch NetBeans IDE on Ubuntu 20.04

To start the NetBeans IDE 12 on Ubuntu 20.04 system, go into the application menu and then search ‘netbeans IDE’ in the application search bar as follows:

Launch netbeans IDE

 You can also launch NetBeans IDE using the terminal by typing the following command:

$ netbeans

 The following loading NetBeans IDE modules window will show on the desktop at the start:

 Loading netbeans modules

After loading all NetBeans modules, the following interface shows on the desktop:

 Apcahe netbeans IDE interface

Method 3: Install NetBeans IDE using snap

Using the snap application, NetBeans IDE can also install on Ubuntu 20.04 system. Print the installed snap version through the following command:

$ snap version

Display snap version

Now, by executing the following command, install netbeans IDE via the snap application:

$ sudo snap install netbeans --classic

 Installing netbeans via snap

Conclusion

We installed the NetBeans IDE  in this article on Ubuntu 20.04 using different ways. Users can choose one method for installation from all of the above-mentioned methods. For more technical knowledge about the netbeans tutorials, you can visit this page.

Share this page:

1 Comment(s)