How to pin Eclipse to the Unity launcher?
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
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:
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.
Related videos on Youtube
Comments
-
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 about 12 yearsI 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 about 12 yearsI'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 almost 8 yearsI had the same problem with Eclipse 4.5.2 and Ubuntu 14.04 - accepted answer worked.
-
-
schmmd almost 13 yearsThis works, but I don't get an icon.
-
Sergey over 12 yearsIs 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 over 12 yearsNo, 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 over 12 years
~/.local/share/applications
is probably where you want to put it. -
nilsonneto over 12 years+1 ... if only for using an animated GIF in your answer!
-
Catskul over 12 yearsWhat do you mean by "drop ... to dash"?
-
geethujoseph over 12 years@Catskul i meant the launcher.
-
Twisted Pear about 12 yearsThanks! 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_ about 12 yearsI 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 about 12 years
/usr/local/share/applications
should also work if you want a global installation. -
eferrari about 12 yearsI think `gnome-desktop-item-edit' needs a certain package?
-
csilk about 12 yearsIt's already executable and your other suggestion of changing sh to bash made no difference.
-
csilk almost 12 yearsIf you look at my config you can see that I am not doing anything with special characters or spaces.
-
Some Noob Student almost 12 yearsgotta love this answer
-
Menda over 11 years@Eshwar 'sudo apt-get install --no-install-recommends gnome-panel'
-
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 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 about 11 yearsAbsolutely amazing :-). Good job!
-
ubuntudroid almost 11 years@alci For me it was StartupWMClass=Eclipse, didn't work lowercase.
-
Ahmad Azwar Anas almost 11 years.. good bos.. ^^
-
Lennart Rolland over 10 yearsOK. 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 over 10 yearsFor 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 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 over 9 yearsDo we seriously need to edit a 10-line file and run some file permissions command to create an app shortcut in 2014?
-
Dan Dascalescu over 9 yearsThis 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 over 9 yearsReally helpful, many thanks.. But when I click on the launcher, although it starts the program, it shows another icon on the launcher.
-
ashes999 almost 9 years+1 this explanation is awesome. I used it to pin Visual Studio Code to the launcher (
StartupWMClass=Code
worked). -
Tim over 8 years@DanDascalescu uhh yeah? That's the way Linux works...
-
Dan Dascalescu over 8 years@Tim: by that logic we should always pay in cash, because that's how money works.
-
Tim over 8 years@DanDascalescu Well the main reason is for security - I don't want a downloaded file running itself (or similar)...
-
BurninLeo over 8 yearsIf 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 thepath
andexec
and you need not to copy/add/drop/... anything else :) -
gone about 8 yearsClick the spring icon in the window to change it to what you want.
-
Dominic Cerisano almost 8 yearsThis 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 almost 8 yearsDoesn't work for me in Ubuntu Desktop 16.04 LTS for Eclipse MARs...getting error at the time of launch...
-
BeeOnRope over 7 yearsIn 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 over 7 yearsFWIW 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 almost 7 yearsdrag and drop eclipse.desktop on to the launcher is the simple last step is required
-
Melebius about 6 yearsTechnically 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 about 6 yearsWhatever 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 almost 3 yearsI 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 almost 2 yearsThis works on 20.04