Skip to content

Instantly share code, notes, and snippets.

@jbuncle
Last active May 8, 2020 16:13
Show Gist options
  • Save jbuncle/02ff866cd799acd5c17ac6ff66ac3afe to your computer and use it in GitHub Desktop.
Save jbuncle/02ff866cd799acd5c17ac6ff66ac3afe to your computer and use it in GitHub Desktop.
Script for installing Netbeans 11 on Linux
#! /bin/bash -e
# bash <(curl -s https://gist.githubusercontent.com/jbuncle/02ff866cd799acd5c17ac6ff66ac3afe/raw)
set -o xtrace
STARTDIR=$(pwd)
VERSION=11.3
sudo apt-get install -y libcanberra-gtk-module
if [ ! -L /usr/bin/netbeans-${VERSION} ] ; then
test -f /tmp/netbeans-source.zip || curl -L http://apache.mirrors.nublue.co.uk/netbeans/netbeans/${VERSION}/netbeans-${VERSION}-source.zip -o /tmp/netbeans-source.zip
test -d /tmp/netbeans-source || unzip /tmp/netbeans-source.zip -d /tmp/netbeans-source
cd /tmp/netbeans-source
test -f ./nbbuild/netbeans/bin/netbeans || ant
test -d /opt/netbeans || sudo mkdir /opt/netbeans
test -d /opt/netbeans/${VERSION} || sudo cp -r ./nbbuild/netbeans /opt/netbeans/${VERSION}
sudo ln -sf /opt/netbeans/${VERSION}/bin/netbeans /usr/bin/netbeans-${VERSION}
# Cleanup
rm -r /tmp/netbeans-source
rm /tmp/netbeans-source.zip
else
echo "Already installed"
fi
# Setup icon for current user
DESKTOP_ENTRY="
[Desktop Entry]
Encoding=UTF-8
Name=NetBeans IDE ${VERSION}
Comment=The Smarter Way to Code
Exec=/bin/sh '/opt/netbeans/${VERSION}/bin/netbeans'
Icon=/opt/netbeans/${VERSION}/nb/netbeans.png
Categories=Application;Development;Java;IDE
Version=${VERSION}
Type=Application
Terminal=0
"
test -f /usr/share/applications/netbeans-$VERSION.desktop | sudo bash -c "echo '${DESKTOP_ENTRY}' > /usr/share/applications/netbeans-$VERSION.desktop"
cd $STARTDIR
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment