Open In App

How to Install Netbeans on a Linux

Last Updated : 08 Jul, 2024
Comments
Improve
Suggest changes
Like Article
Like
Report

NetBeans is an open-source Integrated Development Environment (IDE) primarily for Java programming, but it also supports various other programming languages. It is used to develop mobile applications, desktop applications, and web applications. This guide will help you install NetBeans on a Linux system using different methods.

Prerequisites

To install NetBeans, JDK is required. If you already have JDK, you can skip this installation step.

Step-By-Step Guide To Install Netbeans on a Linux

Installing JDK

1. Open the terminal and enter these commands:

sudo apt update
sudo apt install default-jdk
install_jdk

Installing NetBeans

Method 1: Using Binary Package

Download NetBeans:

  • Open your browser, search for 'NetBeans download,' and click 'Download' in the first search result.
  • Click on the "Download" button to download the latest release of NetBeans. If you want an older release, you can click on the "Find out more" button.
  • Click on the link below the "Binary (Platform Independent)" and then click on the download link; the download will start.
search_netbeans_download
netbeans_download_page_1
dowload_netbeans_page_2
download_binary_package_2
download_link_page

Extract the Downloaded File:

  • After completing the download, open the terminal and change the directory to the Downloads directory where the NetBeans ZIP file was downloaded.

Use the following commands:

cd ~/Downloads
unzip netbeans-{version}-bin.zip

Replace {version} with the actual version of the NetBeans ZIP file you downloaded (e.g., unzip netbeans-22-bin.zip).

change path to Downloads
unzip_netbeans-22-bin.zip

Optional - Move the Extracted Folder:

  • Move the extracted NetBeans folder to a preferred location.
move_netbeans_folder_to_home

Create a Desktop Shortcut and Add NetBeans to the Application Menu:

  • Open Terminal and execute this command:
nano netbeans.desktop
open_nano_editor

Paste the following into the editor, replacing {netbeans_icon_path} and {netbeans_execution_file_path} with the actual paths:

[Desktop Entry]
Version=1.0
Type=Application
Name=NetBeans
Icon={netbeans_icon_path}
Exec={netbeans_execution_file_path}
Categories=Development;IDE;
Terminal=false
netbeans_create_desktop

Save and exit the editor by pressing Ctrl + S and Ctrl + X.

Make the Desktop Entry File Executable:

  • Copy the netbeans.desktop file to your desktop folder and make it executable:
chmod +x ~/Desktop/netbeans.desktop
  • To add NetBeans to the application menu:
sudo cp ~/Desktop/netbeans.desktop /usr/share/applications/
copy_from_destop_to_application_menu

To make desktop entry file in application menu executable: Change the path to ''/usr/share/applications" before running this command

chmod_in_application_menu

Launch NetBeans:

  • Launch NetBeans by clicking on the NetBeans icon on the desktop or in the application menu.
lauch_netbeans

Method 2: Using APT Repository

  1. Add APT Repository:
    • Open Terminal and enter this command
sudo add-apt-repository "deb http://archive.ubuntu.com/ubuntu focal universe"
apt_add_repository

Update Packages List:

  • Enter this command to update the packages list:
sudo apt update
apt_update

Install NetBeans:

  • Enter this command to install NetBeans:

sudo apt install netbeans

apt_install

After executing this command, it will prompt you to continue. Enter 'Y' to proceed with the downloading process.

enter_y

Launch NetBeans:

  • Use the netbeans command or click the NetBeans icon in the application menu.
lauch_netbeans

Method 3: Using Snap

Install NetBeans via Snap:

  • Open Terminal and enter this command:
sudo snap install netbeans --classic
install_by_snap

Launch NetBeans:

  • Use the netbeans command or click the NetBeans icon in the application menu.
lauch_netbeans

Method 4: Using Flatpak

  1. Install NetBeans via Flatpak:
    • Open Terminal and enter this command:
flatpak install flathub org.apache.netbeans
flatpak_install
  • It will prompt you twice. Enter 'Y' to continue.

Launch NetBeans:

  • Use this command:
flatpak run org.apache.netbeans
flatpak_open
lauch_netbeans_flatpak

These are the four ways you can install NetBeans on Linux.

Uninstalling NetBeans

Note: You can only uninstall NetBeans using the same method you used to install it; you cannot use a different method for uninstallation.

Using Binary Package
  1. Locate the Application Folder:
    • Right-click on the NetBeans desktop shortcut, then select 'Open with', and choose your text editor.
    • Find the execution path and copy it (e.g., /home/netbeans).
  2. Remove the Application:
    • Open Terminal and enter this command:
sudo rm -rf {paste_the_copied_path}
open_with_textEditor
execution_path
remove_netbeans

It will remove the application installed using Binary Package.

Using Snap
  • Open Terminal and enter this command:
sudo snap remove netbeans
remove_netbeans_by_snap

Using APT

  • Open Terminal and enter this command:
sudo apt remove netbeans
remove_netbeans_by_apt

Using Flatpak

  • Open Terminal and enter these commands
flatpak uninstall org.apache.netbeans
flatpak uninstall --unused
remove_using_flatpak

Conclusion

In Linux, there are multiple methods to install NetBeans compared to Windows. Choose the method that best suits your needs and install NetBeans on your Linux system. We have covered four installation and uninstallation methods to guide you through the process. By following all the steps correctly, you can successfully install/uninstall NetBeans on your system. Explore NetBeans and start working on your projects.


Next Article
Article Tags :

Similar Reads