Installing the latest Netbeans on Linux


The latest Apache Netbeans

Netbeans is like the child nobody wants. From a student project (1996) to a payed sofrware (1997), it was bought by Sun Microsystems (1999), which in turn got acquired by Oracle (2010), it was eventually donated to the Apache Software Foundation (2016). Apache started the Netbeans Incubator project, where a huge community effort took until 2019 to turn it into Open Sourced Software.

Netbeans version 8 was the last major release under Oracle's name. Then under the Incubator project came versions 9, 10, 11 and 11. Finally version 11.1 was the first official Netbeans release. At the time of writing we've seen even more releases: versions 12, 13 and 14.

We've made a simple script that simply downloads the latest Netbeans version and executes the installer.

Netbeans and Snap: I don't like Snaps…

Really don't like Snaps, it's an invention to patch a dependency problem, which shouldn't have to be a problem at all, especially not with Java. So, use the instructions below to properly install Netbeans, or if you really must use the Snap instructions from below:

  • Latest stable release:
    sudo snap install netbeans --classic
  • Earlier release by version:
    sudo snap install netbeans --channel=12.0/stable --classic

Netbeans 11 LTS (update 2019-12-11)

According to the release schedule, version 11 is a stable release with Long Term Support. Feature releases are 11.1, 11.2. Refer to the release page for the latest versions. available.

Netbeans 9, 10 and 11 obsolete (update 2019-04-04)

Netbeans versions 9, 10 and 11 are all released under the Incubator flag. Since version 11.1 is not an Incubator release, versions before are obsolete.

The previous article where I explained how to install Netbenas 9.0 therefore is even more obsolete.

Manually installing the latest Netbeans

When you go to the Netbeans Release Log, you'll find the latest release on top of the page. Optionally you can find earlier versions too.
It's simply a matter of downloading the Binaries-zip and extracting it.

There used to be .sh files (which are executable and self-installing), but these are no longer available. You can use community provided dpkg files instead.

Installing the latest Netbeans using Bash

Below two bash functions install_netbeans and remove_netbeans, which you can add to a separate script, add to your ~/.bash_aliases or ~/.oh-my-zsh/custom/aliases.zsh. Then, when you open a new terminal you can simply type install_netbeans to get the latest version, or install_netbeans to choose a version. To remove a version use remove_netbeans .

function install_netbeans() {
  local CG='\e[0;32m'
  local CR='\e[0;31m'
  local NC='\e[0m'

  local mirror=""
  local version="$1"

  # Find latest version if not set
  if [ -z "$version" ]; then
    mirror=$(curl "" -s | grep 'preferred' | cut -d'"' -f4)
    version=$(curl "$mirror/netbeans/netbeans/" -s | grep -oP '>[\d\.]+/<' | tail -n1 | cut -d'>' -f2 | cut -d'/' -f1)

  if [ -z "$version" ]; then
    echo -e "${CR}GUnable to automatically retrieve latest version, please pass version manually:${NC}"
    echo -e "${CG}install_netbeans [version]${NC}"
    return 1

  local target="/usr/local/netbeans-$version/"
  echo -e "${CG}Selected version is Netbeans $version.${NC}"

  if [ -d "$target" ]; then
    echo -e "${CG}Latest version already installed, noting to do.${NC}"
    return 0

  # Work from tmp
  local ORIGDIR=$(pwd)
  cd /tmp

  # Download urls
  local zip="$mirror/netbeans/netbeans/$version/netbeans-$"
  local verify="$zip.sha512"

  echo -e "${CG}Downloading installer and sha512-sum from $mirror...${NC}"
  curl "$zip" -o netbeans-$ -# --progress-bar
  if [ ! -f "netbeans-$" ]; then
    echo -e "${CR}Unable to download archive, check if version exists.${NC}"
    return 1

  curl "$verify" -o netbeans-$ -# --progress-bar
  if [ ! -f "netbeans-$" ]; then
    echo -e "${CR}Unable to download sha512-sum, check if version exists.${NC}"
    return 1

  echo -n "${CG}Verifying integrity...${NC}"
  sha512sum -c netbeans-$
  if [ $? -gt 0 ]; then
    echo -e "${CR}Check failed!${NC}"
    return 1

  echo -e "${CG}Ensure we have default-jdk...${NC}"
  sudo apt install -y default-jdk

  echo -e "${CG}Extract Netbeans zip and move into $target...${NC}"
  unzip netbeans-$ | pv -l -s $(unzip -Z -1 netbeans-$ | wc -l) > /dev/null;
  sudo mv netbeans/ $target

  echo -e "${CG}Add desktop entry...${NC}"
  echo "[Desktop Entry]
Name=NetBeans $version
Comment=The Smarter Way to Code
Exec=/bin/sh \"/usr/local/netbeans-$version/bin/netbeans\"
Terminal=0" | sudo tee /usr/share/applications/netbeans-$version.desktop > /dev/null

  # Cleanup and go back
  rm -rf netbeans/ netbeans-$version-bin.*

  echo -e "${CG}Done! Enjoy Netbeans $version!${NC}"

function remove_netbeans() {
  local CG='\e[0;32m'
  local CR='\e[0;31m'
  local NC='\e[0m'

  local version=$1
  if [ -z "$1" ]; then
    echo -e "${CR}Usage: remove_netbeans [version]${NC}"
    return 1

  local target="/usr/local/netbeans-$version/"
  local desktop="/usr/share/applications/netbeans-$version.desktop"

  echo -e "${CG}Removing NetBeans $version...${NC}"
  sudo rm -rf $target
  sudo rm -f $desktop
  echo -e "${CG}Done!${NC}"

After Netbeans installation

If you have a previous version of Netbeans installed, it will ask you to import settings from that version, which I strongly recommend you to do to not break your workflow.