nicholasadamou
7/8/2011 - 3:03 AM

Installing the Latest Eclipse in Ubuntu

Installing the Latest Eclipse in Ubuntu

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 <http://shaun.boyblack.co.za/blog/2009/05/18/a-nice-eclipse-icon/>`_. Based on `these instructions <http://devianture.wordpress.com/2010/04/10/installing-eclipse-on-ubuntu/>`_.

* Run the script, like this: ``bash <(wget -qO- https://gist.github.com/raw/1071034/install-eclipse.sh)``
* When prompted, find the URL of the Eclipse Linux gzipped tarball you want to install from `the Eclipse website <http://www.eclipse.org/downloads/>`_.

    * Note: The link that you want has text that looks like *[Australia] Australian Academic Research Network (http)* - right click this and choose *Copy Link Address* to get the URL the script wants.

* 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.

.. [#] In my experience, Eclipse (particularly CDT) has been more stable under OpenJDK than the Sun JRE, even though Eclipse recommends it.
#!/bin/bash

# If you're reading this on the GitHub gist, scroll down for instructions.
# If not, go to https://gist.github.com/1071034

icon_url="http://shaun.boyblack.co.za/blog/wp-content/uploads/2009/05/maceclipse4.zip"

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 "Enter the URL for the Eclipse gzipped tarball:"
read eclipse_url

echo "Installing dependencies..."
sudo apt-get install imagemagick openjdk-6-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