Saturday, 21 July 2012

Installing Eclipse Juno 4.2 on Ubuntu 12.04 or 12.10


I don't know why, but there does not seem to be a package ppa for juno yet. I had to use an alternative method to install. It really wasn't all that complicated in the end and this would probably work on the other flavours of Ubuntu too, but a word of warning:  

 Bear in mind, I did this on a clean install; you will need to move your old install to another directory if you want to avoid problems.

The first part I got from this person's blog but, as is oft' the way, I was guided through the easy bit, then suddenly, I must have become an expert or something, because I came to a part where it said: 'you will need to create a script in /usr/bin to be the "executable" for eclipse'

"...Eh? Oh righty then!"

I got on that... Only took several hours and, a complete reinstall of my OS, but here it is: The full instruction on how to do it. Get Juno on your Lubuntu 12.04, that is. Open terminal:

>>sudo add-apt-repository -y ppa:webupd8team/java

>>sudo apt-get update

>>sudo apt-get install -y oracle-jdk7-installer

Download eclipse Juno from here and go to the directory where you downloaded it to (usually Downloads).

>>cd Downloads

Extract whatever way you wish, I chose:

>>tar -zxvf eclipse-SDK-4.2-linux-gtk.tar.gz

If I was doing it on my 64 bit version it would have been:

>>tar -zxvf eclipse-SDK-4.2-linux-gtk-x86_64.tar.gz

(but right click > extract works too.)

Move the eclipse contents into this directory, like so:

  >>sudo mv eclipse /usr/lib/

Then I was failed by the rest of the blog and overwhelmed on my own! I eventually pieced random bits of the internet together, to figure out how to create the executable file and set the paths without it all falling apart (again).

To be fair the rest of my instruction here is bits I took from this person's blog post about another distro of eclipse and ubuntu, the important difference to notice is that he installed in opt, whereas I kept with usr like the first blogger used. I did this because it felt like the right thing to do to stay more global, but I really cannot say which would be the more appropriate choice. Early days, but here's where I ended up:

>>sudo touch /usr/bin/eclipse


>>sudo chmod 755 /usr/bin/eclipse


The chmod 755 bit is you setting the permissions here's a description of it. Then:

>>sudo leafpad /usr/bin/eclipse

By the way, Leafpad is just a text editor. It could be anything you fancy (e.g. nano, gedit, kate etc etc), the important thing is that once you have the file open in the text editor you paste this into it:

#!/bin/sh

export ECLIPSE_HOME=" /usr/lib/eclipse/eclipse"

Save and close.

To create the icon, and set the paths inside it I needed to open a text editor to write up a new file called eclipse.desktop (created below)

>>sudo leafpad /usr/share/applications/eclipse.desktop

Inside the file pasted this:

[Desktop Entry]

Type=Application
Encoding=UTF-8
Name=Eclipse
Comment=Eclipse IDE
Exec=/usr/lib/eclipse/eclipse
Icon=/usr/lib/eclipse/icon.xpm
Terminal=false
Type=Application
Categories=GNOME;Application;Development;
StartupNotify=true

Save and close.

Find eclipse now by going into programming menu and clicking on the eclipse icon which starts up Juno! (See comments for how to fix large icon in 12.10: It seems there is an update so paths are configured directly to install folder so you can rename accordingly.)