Linux – Install Eclipse IDE

The easiest way to install Eclipse in Ubuntu is through the standard repository


sudo apt-get install -y eclipse

Unfortunately, this install an outdated version. Currently the version 3.8.0 gets installed,
although the latest stable version is 4.2.1.

The eclipse team does have a Debian PPA as well, ppa:eclipse-team/debian-package.
Adding this PPA doesn’t change anything and the outdated will be installed.

So if you really need the latest stable version, just download it from eclipse.org or any mirror sites, extract the
archive and start eclipse.

Like this for instance:


#use /tmp as working directory
cd /tmp

# download eclipse from your nearest mirror or here, 64bit
wget http://mirror.selfnet.de/eclipse/eclipse/downloads/drops4/R-4.3-201306052000/eclipse-SDK-4.3-linux-gtk-x86_64.tar.gz
tar -zxf eclipse-SDK-4.3-linux-gtk-x86_64.tar.gz
cd eclipse

# Resize Eclipe xpm icon
# get mogrify - need to install imagemagick
sudo apt-get install -y imagemagick

# convert eclipse icon.xmp to icon.png
mogrify -format png icon.xpm

#resize icon.png to a 16x16 icon
#convert -resize 12% icon.png icon2.png
convert -resize 16x16 icon.png icon2.png
cd ..

# make root own eclipse
sudo chmod -R +r eclipse
sudo chown -R 0:0 eclipse

# move eclipse to /opt
sudo mv eclipse /opt/

# create start script /usr/bin/eclipse
sudo sh -c 'echo "
#!/bin/sh
export ECLIPSE_HOME="/opt/eclipse"
\$ECLIPSE_HOME/eclipse \$*
" > /usr/local/bin/eclipse'

# set permissions for eclipse start script, /usr/bin link
sudo chmod 755 /usr/local/bin/eclipse
sudo ln -s /usr/local/bin/eclipse /usr/bin/eclipse

# Create a desktop file and place it into /usr/share/applications
sudo sh -c 'echo "
[Desktop Entry]
Name=Eclipse
Type=Application
Exec=eclipse
Terminal=false
Icon=/opt/eclipse/icon2.png
Comment=Integrated Development Environment
NoDisplay=false
Categories=Development;IDE
Name[en]=Eclipse IDE
" > /usr/share/applications/eclipse.desktop'

#Applications Menu -> Development -> Eclipse IDE
# reload menu - work only with XFCE :)
xfdesktop --reload

# start eclipse
# eclipse

That’s it!

In case of library errors….

# Add /usr/local/lib to /etc/ld.so.conf
if [ "`grep '/usr/local/lib' /etc/ld.so.conf`" == "" ] ; then
   sudo sh -c ' printf "\n/usr/local/lib" >> /etc/ld.so.conf';
fi;
sudo ldconfig

References

1. http://askubuntu.com/questions/26632/how-to-install-eclipse
2. http://askubuntu.com/questions/1164/how-to-easily-resize-images
3. http://nixcraft.com/shell-scripting/2413-linux-png-image-resize-command.html
4. http://www.howtogeek.com/109369/how-to-quickly-resize-convert-modify-images-from-the-linux-terminal/