How to install NetBeans IDE on Ubuntu 20.04
On this page
- Installing NetBeans Prerequisites
- Installing Netbeans IDE on Ubuntu 20.04
- Method 1: Install NetBeans IDE using Ubuntu apt repository
- Method 2: Install NetBeans IDE by downloading the archive source code
- Method 3: Install NetBeans IDE using snap
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
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.
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:
- Install Netbeans IDE using Ubuntu apt repository
- Install Netbeans IDE by downloading the archive source code
- Install Netbeans IDE using snap
- 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"
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.
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
Once the zip archive is downloaded, verify the file download process by running the below-mentioned command:
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
Again, list the created directory content for verification as follows:
$ ls netbeans
Step 3: Adjust NetBeans files PATH
Move the netbeans directory to /opt by running the below-mentioned command:
$ sudo mv netbeans/ /opt/
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:
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:
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:
You can also launch NetBeans IDE using the terminal by typing the following command:
The following loading NetBeans IDE modules window will show on the desktop at the start:
After loading all NetBeans modules, the following interface shows on the desktop:
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
Now, by executing the following command, install netbeans IDE via the snap application:
$ sudo snap install netbeans --classic
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.