Wednesday, 6 February 2013

Install, Create, or Pin Eclipse in Launcher Ubuntu Unity

Hi, this was a popular post on my old blog, so I thought I would re-post it.

Thing 1
Download the eclipse tarfile that you want to install from: http://www.eclipse.org/downloads/

See here how to extract the file if you do not know

http://objectisnull.blogspot.co.uk/2013/10/extract-tar-targz-tarbz2-files-linux.html

Thing 2
Now you have a folder called eclipse sitting in, lets say your Downloads folder. (switch Downloads to wherever you have extracted the eclipse folder)
remember, if you’re coming from windows, linux file system and commands are case sensitive, so make sure to be mindful of that when issuing the upcoming commands :)
Now we are ready to move the eclipse folder to where all application should live on our system /usr/lib/

So, our first command:

sudo mv ~/Downloads/eclipse /usr/lib/

Thing 3
So, this tutorial is about getting a nice icon on our launcher to start eclipse, but while we are here, we should also give ourselves the ability to start eclipse by typing “eclipse” in the terminal, so lets do that now. We will create a symbolic link in /usr/bin/.

sudo ln -s /usr/lib/eclipse/eclipse /usr/bin/eclipse

Thing 4
We now have everything in the right place, all we need to do is create a file that can be locked to the launcher once its opened. Remember, the launcher works differerently from other docks. You cant just drag the eclipse icon on to it. Once we are done with this step, youll open clipse, then right click on launcher and chose “lock to launcher” - anyway, lets get on with it:

so, we’re going to create a .desktop file in “/usr/share/applications”:

sudo gedit /usr/share/applications/eclipse.desktop

(you can switch gedit for vi, nano, or whatever editor you prefer to use)

now put the following content in that file:

[Desktop Entry]
Version=3.7
Name=Eclipse
GenericName=Text Editor

Exec=eclipse
Terminal=false
Icon=/usr/lib/eclipse/icon.xpm
Type=Application
Categories=IDE;Development
X-Ayatana-Desktop-Shortcuts=NewWindow

[NewWindow Shortcut Group]
Name=New Window
Exec=eclipse -n
TargetEnvironment=Unity

thats it, were all done. to test everything is wired up correctly, go in to /usr/share/applications/ via file manager, and double click the eclipse icon to start eclipse. it should launch with no problems.

once thats done, right click the eclipse icon on the launcher, and select lock to launcher..

enjoy,

Paul