2

I recently upgraded to Eclipse Luna and since then I've had trouble launching it from the Unity Launcher. I've modified my old .desktop file located in ~/.local/share/applications, then added it to my launcher and now it looks like this:

Valid XHTML


How can I fix this?

For reference, here's my eclipse.desktop file:

#!/usr/bin/env xdg-open
[Desktop Entry]
Version=1.0
Type=Application
Terminal=false
Path=/home/jinkim/eclipse
Icon=/home/jinkim/eclipse/icon.xpm
Exec=/home/jinkim/eclipse/eclipse
Name=Eclipse Luna
Comment=This is an IDE
Icon=eclipse
  • slightly different symptom, same cause. – Jacob Vlijm Sep 22 '14 at 19:14
  • It's a slightly different problem, as I have already done grep -rI "eclipse" in /usr/share/applications and it turns up with nothing. The only eclipse-related .desktop file I can see is the one in my ~/.local directory – Jin Sep 22 '14 at 19:19
  • You really must have two, calling the same application, but differently named. I'll take a look... – Jacob Vlijm Sep 22 '14 at 19:21
  • Could you grep -rI "eclipse" in ~/.local/share/applications? it is possible that files have slightly different names. – Jacob Vlijm Sep 22 '14 at 19:32
  • Yes I tried the grep in ~/.local/share/applications and it turned up with the desktop file noted above. However, after searching for solutions I managed to get a working .desktop file. I will answer this question with what worked for me. Thanks! – Jin Sep 22 '14 at 20:20
2

It seems there a line in the .desktop file that I was missing. In particular, the crucial line seems to be:

StartupWMClass=Eclipse

More info on that here: What represent the StartupWMClass field of a .desktop file?

So, I have found what works for me below:

#!/usr/bin/env xdg-open
[Desktop Entry]
Name=Eclipse
GenericName=Eclipse Java IDE
Comment=Eclipse Java IDE
Categories=Utility;Developer Tools;IDEs;Java;
Exec=/home/(your-username-here)/eclipse/eclipse
Icon=/home/(your-username-here)/eclipse/icon.xpm
StartupWMClass=Eclipse
StartupNotify=true
Terminal=false
Type=Application
X-GNOME-FullName=Eclipse Java IDE

The steps I took to get this working are:

  1. Use a text editor to create eclipse.desktop, and paste the above into it

  2. Move eclipse.desktop into ~/.local/share/applications

  3. Allow it to be executable: chmod +x eclipse.desktop

  4. Double-click eclipse.desktop which should appear in Nautilus as Eclipse

  5. In Unity launcher, right-click and select "Lock to Launcher"

  • The weird thing is that you had two (correct eclipse) icons. Usually in these cases one of them is apppearing as a question mark, that's why the StartupWMClass -thought didn't come into my mind. – Jacob Vlijm Sep 23 '14 at 6:48
0

I had this same problem of duplicated icon. but in my case it was caused because I double clicked in the eclipse executable and ask unit to lock it in the launcher. this action makes unity to create an eclipse.desktop file into ~/.local/share/applications where its "exec=" was set to java instead of eclipse executable. After I removed the one created by unity and added my own, the problem was solved.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.