How to pin Eclipse to the Unity launcher?

274,515

Solution 1

For 11.10 and newer

First, create a .desktop file to eclipse:

gedit ~/.local/share/applications/opt_eclipse.desktop

Then, paste this inside (dont forget to edit Exec and Icon values):

[Desktop Entry]
Type=Application
Name=Eclipse
Comment=Eclipse Integrated Development Environment
Icon=** something like /opt/eclipse/icon.xpm **
Exec= ** something like /opt/eclipse/eclipse **
Terminal=false
Categories=Development;IDE;Java;
StartupWMClass=Eclipse

After that, open that folder with nautilus:

nautilus ~/.local/share/applications

If you want to use this launcher outside dash/launcher (ex: as a desktop launcher) you need to add execution permission by right clicking the file and choosing Properties -> Permissions -> Allow execution, or, via the command-line:

chmod +x ~/.local/share/applications/opt_eclipse.desktop

Finally drop opt_eclipse.desktop to launcher.

Solution 2

For Ubuntu 11.10, 12.04, 12.10

If the applications folder does not exist inside ~/.local/share/ create it

mkdir ~/.local/share/applications

Check if your installation left you with a workable .desktop file for Eclipse and copy it if exists

cp /usr/share/applications/eclipse.desktop ~/.local/share/applications/

If the file does not exist create a .desktop file for Eclipse in your ~/.local/share/applications/ folder using gnome-desktop-item-edit, ie:

gnome-desktop-item-edit --create-new ~/.local/share/applications/

On the name set it to Eclipse, on the command enter the path to the binary file of Eclipse, insert a comment if you want and click the icon to select the icon that you desire for Eclipse.

Press ok when you are finished.


After copying the file or creating your own open that folder location

nautilus ~/.local/share/applications/

Locate the file you just created and drag it to the launcher

enter image description here

Solution 3

11.04

If user21580's answer doesn't work (great suggestion, but I think it didn't work for me when I installed Indigo), you can try adding an eclipse.desktop file to ~/.local/share/applications/, with these contents:

#!/usr/bin/env xdg-open

[Desktop Entry]
Version=1.0
Type=Application
Terminal=false
StartupNotify=true
Icon=<path-to-eclipse-install>/icon.xpm
Name=Eclipse Indigo 3.7
#Exec=env UBUNTU_MENUPROXY=0 <path-to-eclipse-install>/eclipse
Exec=env <path-to-eclipse-install>/eclipse

If you experience bugs, you can try the Exec line which is commented out instead of the current one.

References:

Solution 4

Let me show you how to create a custom launcher and pin it to the Launcher.

1) First, install gnome-panel:

sudo apt-get install --no-install-recommends gnome-panel

2) To create a new desktop shortcut run the following command either in the terminal or using Alt-F2:

gnome-desktop-item-edit --create-new ~/Desktop

A window will pop up, submit your shortcut details and click OK:

enter image description here

Your shortcut will now appear on your desktop.

Then drag your new shortcut from Desktop to your Launcher.

That's it!

Solution 5

If you have donwloaded Eclipse from the website instead of install it from repositories you can lock the launcher doesn't work. You can solve this by writting the file with extension .desktop, in our case eclipse.desktop.

 [Desktop Entry]
 Name=Eclipse
 Comment=Eclipse
 Exec=/path/eclipse
 Icon=/path/icon.xpm
 Terminal=false
 Type=Application

Where /path is where you've installed eclipse. After you have saved it, you have to give execution permission:

$ chmod +x eclipse.desktop

Then you execute it with Nautilus and by clicking (right click) over the laucher you can lock to the launcher. And you can launch the app correctly.

Share:
274,515

Related videos on Youtube

SimplyLearning
Author by

SimplyLearning

4th year Computer Engineering Student

Updated on September 18, 2022

Comments

  • SimplyLearning
    SimplyLearning over 1 year

    How can I pin eclipse indigo 3.7 I have 'installed' at /opt/ to the taskbar?

    I have tried launching eclipse and right-clicking to choose the 'keep in launcher' option. But when I click that icon, after closing eclipse, it doesn't start eclipse.

    I have already looked at How do I add Eclipse Indigo to the launcher? but no answer worked for me. (Mod note: The answers from this thread are now merged into this one)

    • Admin
      Admin about 12 years
      I can start Eclipse directly from the executable in /home/USERNAME/eclipse. When I do this, the Eclipse icon on the dock has a little arrow next to it, so it is aware of Eclipse running. How strange.
    • Admin
      Admin about 12 years
      I've had the same error, I was trying to execute eclipse_64bit on ubuntu_32bit. Have you downloaded 64bit version of Eclipse? Have you checked your ubuntu installation?
    • Admin
      Admin almost 8 years
      I had the same problem with Eclipse 4.5.2 and Ubuntu 14.04 - accepted answer worked.
  • schmmd
    schmmd almost 13 years
    This works, but I don't get an icon.
  • Sergey
    Sergey over 12 years
    Is it really necessary to create the .desktop file outside user's home folder? As you can see, this requires sudo, which is potentially unsafe; also, the file may be removed by a system upgrade or reinstall. What are the benefits?
  • geethujoseph
    geethujoseph over 12 years
    No, you can create the file where you want. I suggested this location because it's the folder where usually .desktop files are stored (so it is "found" by applications like unity, gnome do, etc). The name is unfortunate, because it's the same of the .desktop file created by eclipse package, when installed by Software Manager. I'll change it.
  • Jorge Castro
    Jorge Castro over 12 years
    ~/.local/share/applications is probably where you want to put it.
  • nilsonneto
    nilsonneto over 12 years
    +1 ... if only for using an animated GIF in your answer!
  • Catskul
    Catskul over 12 years
    What do you mean by "drop ... to dash"?
  • geethujoseph
    geethujoseph over 12 years
    @Catskul i meant the launcher.
  • Twisted Pear
    Twisted Pear about 12 years
    Thanks! This one worked for me. Too bad Ubuntu has to make it so difficult. Why not just right click on the launcher for this kind of option?
  • T_S_
    T_S_ about 12 years
    I also had to append StartupWMClass=eclipse at the end of the .desktop file, or else Unity was unable to detect if an instance was already running or not (thus trying to re-launch eclipse each time, and failing due to locks on the workspace)
  • detly
    detly about 12 years
    /usr/local/share/applications should also work if you want a global installation.
  • eferrari
    eferrari about 12 years
    I think `gnome-desktop-item-edit' needs a certain package?
  • csilk
    csilk about 12 years
    It's already executable and your other suggestion of changing sh to bash made no difference.
  • csilk
    csilk almost 12 years
    If you look at my config you can see that I am not doing anything with special characters or spaces.
  • Some Noob Student
    Some Noob Student almost 12 years
    gotta love this answer
  • Menda
    Menda over 11 years
    @Eshwar 'sudo apt-get install --no-install-recommends gnome-panel'
  • Marky
    Marky over 11 years
    @Salem Ok, this is late but you don't need the desktop file to have executable permission "On". Just leave it as it is, drag to the launcher and it will execute whatever you placed in the exec part of the .desktop file.
  • geethujoseph
    geethujoseph over 11 years
    @Marky yes that's true. That was added by others and i let it stay because it doesn't hurt, and if you don't add the execution permission, you can't launch it in Nautilus (double-click) neither is shown the icon defined in "Icon".
  • Rostislav Stribrny
    Rostislav Stribrny about 11 years
    Absolutely amazing :-). Good job!
  • ubuntudroid
    ubuntudroid almost 11 years
    @alci For me it was StartupWMClass=Eclipse, didn't work lowercase.
  • Ahmad Azwar Anas
    Ahmad Azwar Anas almost 11 years
    .. good bos.. ^^
  • Lennart Rolland
    Lennart Rolland over 10 years
    OK. I know this probably WORKS. But, why the hell is it necessary? I just want to start my app, right click the launcher icon that appears and have Ubuntu fix things for me. I challenge thee oh fine Ubuntu developers, make it so!
  • user1170330
    user1170330 over 10 years
    For me it only works when I start it directly from nautilus. When I drop the icon to the launcher and start it from there, it won't work.
  • Steve M
    Steve M over 9 years
    @LennartRolland It only broke for me after I moved the location of Eclipse folder after pinning it. In 14.04 the posted solution worked to fix it.
  • Dan Dascalescu
    Dan Dascalescu over 9 years
    Do we seriously need to edit a 10-line file and run some file permissions command to create an app shortcut in 2014?
  • Dan Dascalescu
    Dan Dascalescu over 9 years
    This doesn't pick up the icon of the app, and when dragged into the Unity task bar, it spawns yet another icon for the app. Don't mean to troll, but the experience of creating a shortcut in OS X or Windows is way, way better.
  • Maroun
    Maroun over 9 years
    Really helpful, many thanks.. But when I click on the launcher, although it starts the program, it shows another icon on the launcher.
  • ashes999
    ashes999 almost 9 years
    +1 this explanation is awesome. I used it to pin Visual Studio Code to the launcher (StartupWMClass=Code worked).
  • Tim
    Tim over 8 years
    @DanDascalescu uhh yeah? That's the way Linux works...
  • Dan Dascalescu
    Dan Dascalescu over 8 years
    @Tim: by that logic we should always pay in cash, because that's how money works.
  • Tim
    Tim over 8 years
    @DanDascalescu Well the main reason is for security - I don't want a downloaded file running itself (or similar)...
  • BurninLeo
    BurninLeo over 8 years
    If you already told to 'keep in launcher' eclipse, there will be a file eclipse.desktop in /usr/local/share/applications (thanks to detly). Just edit the path and exec and you need not to copy/add/drop/... anything else :)
  • gone
    gone about 8 years
    Click the spring icon in the window to change it to what you want.
  • Dominic Cerisano
    Dominic Cerisano almost 8 years
    This answer 5 years old, and the only one that still works in 2016. Of course, Ubuntu could just upgrade the version of Eclipse on the software center so people would not have to do manual installs that break the shortcut generation process.
  • Ashu
    Ashu almost 8 years
    Doesn't work for me in Ubuntu Desktop 16.04 LTS for Eclipse MARs...getting error at the time of launch...
  • BeeOnRope
    BeeOnRope over 7 years
    In 16.04 for eclipse Mars, I didn't need to jump through any hoops - I just chose "Add to dash" and "Lock to launcher" when eclipse was open and that locked icon worked to launch eclipse.
  • BeeOnRope
    BeeOnRope over 7 years
    FWIW with 16.04 and Eclipse Mars (newer than the software center version) I didn't need to jump through any hoops - I just chose "Add to dash" and "Lock to launcher" when eclipse was open and that locked icon worked to launch eclipse. I'm not sure if Unity changed, or eclipse did...
  • Raaghu
    Raaghu almost 7 years
    drag and drop eclipse.desktop on to the launcher is the simple last step is required
  • Melebius
    Melebius about 6 years
    Technically speaking, there is no Unity in 18.04. However, the instruction for the new default desktop (GNOME) is probably OK to be posted here.
  • Phil
    Phil about 6 years
    Whatever the launcher is in 18.04, it looks the same as what was in 16.04 and 14.04. I don't overly care what it is called.
  • Milan
    Milan almost 3 years
    I tried this on Ubuntu 18.04 but upon double-clicking on the file, it says The Eclipse executable launcher was unable to locate its companion shared library! How can I fix this error?
  • Admin
    Admin almost 2 years
    This works on 20.04