3

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
frog
  • 18
Jin
  • 193
  • 1
  • 8

3 Answers3

5

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"

Jin
  • 193
  • 1
  • 8
0

Depending on how you installed Eclipse and which distribution you chose, you may find the StartupWMClass needs a different value (Use the xprop WM_CLASS method described in the link in Jin's answer above).

Having built a custom Eclipse from the Platform Runtime distribution, I was getting an extra "No Entry" icon with "SWT" as its caption. Using xprop WM_CLASS told me the class is called "SWT", and setting StartupWMClass=SWT resolves the problem.

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.

Cristiano
  • 217