nicholasadamou
9/4/2017 - 2:20 PM

Installs Eclipse on Ubuntu 17.04 or higher.

Installs Eclipse on Ubuntu 17.04 or higher.

#!/bin/bash

# If you're reading this on the GitHub gist, read the README for instructions.
# If not, go to https://gist.github.com/nicholasadamou/91f6f9fea968d8b8c6b47161c8ace415

icon_url="http://shaun.boyblack.co.za/blog/wp-content/uploads/2009/05/maceclipse4.zip"
eclipse_url="http://mirror.math.princeton.edu/pub/eclipse//technology/epp/downloads/release/oxygen/R/eclipse-java-oxygen-R-linux-gtk-x86_64.tar.gz"

eclipse_bin="#!/bin/sh
export ECLIPSE_HOME='/opt/eclipse'
\$ECLIPSE_HOME/eclipse \$*"

eclipse_desktop="[Desktop Entry]
Encoding=UTF-8
Name=Eclipse
Comment=Eclipse IDE
Exec=eclipse
Icon=/opt/eclipse/icon.xpm
Terminal=false
Type=Application
Categories=GNOME;Application;Development;
StartupNotify=true"


echo "Installing dependencies..."
sudo apt-get install -y imagemagick default-jre

echo "Downloading Eclipse..."
wget -O eclipse.tar.gz "$eclipse_url"

echo "Downloading improved icon..."
wget -O icon.zip "$icon_url"

tar xvf eclipse.tar.gz
unzip icon.zip MacEclipse4/EclipseLogo512.png
convert MacEclipse4/EclipseLogo512.png eclipse/icon.xpm
sudo mv eclipse /opt/eclipse
sudo touch /usr/bin/eclipse
sudo chmod 755 /usr/bin/eclipse
echo -e "$eclipse_bin" | sudo tee /usr/bin/eclipse
echo -e "$eclipse_desktop" | sudo tee /usr/share/applications/eclipse.desktop
if [ -e "eclipse.tar.gz" ]; then
  sudo rm -rf eclipse.tar.gz
fi
if [ -e "MacEclipse4" ]; then
  sudo rm -rf MacEclipse4
fi
if [ -e "icon.zip" ]; then
  sudo rm -rf icon.zip
fi

Installing the Latest Eclipse in Ubuntu

Here's a short shell script to quickly install the latest Eclipse in Ubuntu, since the one in the repositories is about two years old. As a bonus, it also replaces the ugly Eclipse icon with a nicer one by Shaun Smith. Based on these instructions.

  • Run the script, like this: bash <(wget -qO- https://gist.github.com/nicholasadamou/91f6f9fea968d8b8c6b47161c8ace415/raw/85632ae2e14a18472343e07bf1a41047954a3d19/install_eclipse.sh)

  • The script will install OpenJDK, download Eclipse, patch the icon so it looks less ugly, and put all of the right files in the right places.