3

I upgraded Eclipse yesterday to version 4.3 and was faced with the missing menus bug. To get the menus back one has to start Eclipse in a different way, thus I tried to create a new item in the Main Menu.

For some reason the item is not stored by the Main Menu, I get no error messages when I click the OK button in the new item dialogue, but nothing changes in the Application group.

Am I doing something wrong? Thanks.

Update I: user wilf tells me to add a file named eclipse.desktop in /usr/share/applications but this has not created an new item in the Main Menu:

enter image description here

Update II: Here's how my eclipse.dektop file looks like:

$ ls -la /usr/share/applications/e*
-rw-r--r-- 1 root root 3083 May 11  2012 /usr/share/applications/easytag.desktop
-rw-r--r-- 1 root root  167 Jan 25 17:02 /usr/share/applications/eclipse.desktop
-rw-r--r-- 1 root root  921 Oct 31 20:30 /usr/share/applications/empathy.desktop
-rw-r--r-- 1 root root  856 Jun 29  2013 /usr/share/applications/eog.desktop
-rw-r--r-- 1 root root  894 Oct  8 23:21 /usr/share/applications/evince.desktop
-rw-r--r-- 1 root root  873 Oct  8 23:21 /usr/share/applications/evince-previewer.desktop

$ cat /usr/share/applications/eclipse.desktop
[Desktop Entry]
Type=Application
Name=Eclipse
Icon=eclipse
Exec=env UBUNTU_MENUPROXY=/usr/local/eclipse.kepler/eclipse
Terminal=false
Categories=Development;IDE;Java;

Beyond this, is there any other way to get the Eclipse icon showing up in the dash?

4
+50

You write in your question that your .desktop file contains this:

Exec=env UBUNTU_MENUPROXY=/usr/local/eclipse.kepler/eclipse

but it should contain something like this:

Exec=env UBUNTU_MENUPROXY= /usr/local/eclipse.kepler/eclipse

Note the space between = and /. The UBUNTU_MENUPROXY variable needs to be unset for eclipse to work correctly. You are setting it to eclipse and not launching any applications.

Though I don't know if this solves your problem, since I think this shouldn't cause the icon not showing up, just it won't do anything when clicked.


UPDATE: So the above haven't made eclipse to show up, here is one more thing you can try:

Put the .desktop file in the ~/.local/share/applications/ directory, this is where you can store per-user .desktop files, maybe unity will detect it from there. If it does, don't forget that the .desktop files in that directory is only available to the user in whose home directory the .desktop file is located, so if you have more users just copy the .desktop file to every users ~/.local/share/applications/ directory.

Also note that for the desktop files in ~/.local/share/applications/ it is needed to logout to show up in the dash. (I don't know why, but it is so on my side.) So if you put there the .desktop file don't forget to logout/logback.

  • Hi falconer, I changed the .desktop file as you suggest, but I still have no Eclipse item in the Dash or Alacarte. – Luís de Sousa Jan 30 '14 at 19:54
  • @LuísdeSousa There are some things which are not clear for me from you question: Are you using Unity? (I guess you are because of the unity tag.) When you say "the item is not stored by the Main Menu", what Main Menu are you referring to? The Dash or the Launcher bar on the left? Or you are just referring to that picture from alacarte in your screenshot? If you are just referring to that screenshot, then you are looking at the wrong place there, since you created the .desktop file with "Categories=Development;IDE;Java;", it will be shown under programming, not under other. – falconer Jan 30 '14 at 20:22
  • Hi again falconer, I am using Unity. The screen shots where taken at an earlier stage, before the .desktop file had the Categories section. When I say "Main Menu" I refer to Alacarte, since that is the name by which it is shown in the Dash (this is rather confusing). The Eclipse item is not present anywhere at the moment in Alacarte, neither in Others, nor in Programming, nor anywhere else. It isn't shown in the Dash either, weather I search for it or going through the sections in Applications. – Luís de Sousa Jan 31 '14 at 8:16
  • 1
    @LuísdeSousa Okay, thanks for the clarification. It is strange that is is nowhere shown. One more thing you can try is to put the .desktop file in the ~/.local/share/applications/ directory, this is where you can store per-user .desktop files, maybe unity will detect it from there. If it does, don't forget that the .desktop files in that directory is only available to the user in whose home directory the .desktop file is located, so if you have more users just copy the .desktop file to every users ~/.local/share/applications/ directory. – falconer Jan 31 '14 at 10:35
  • 1
    @LuísdeSousa Also note that for the desktop files in ~/.local/share/applications/ it is needed to logout to show up in the dash. I don't know why, but it is so on my side. So if you put there the .desktop file don't forget to logout/logback. – falconer Jan 31 '14 at 11:09
2

Locate the path of your executable file with which command:

which eclipse

Create a .desktop file:

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

Open the file with a text editor of your choice, with root privileges, say with nano as:

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

and copy the following to the file and save the work: source

[Desktop Entry]
Type=Application
Name=Eclipse
Icon=eclipse
Exec=env UBUNTU_MENUPROXY=path_to_eclipse
Terminal=false
Categories=Development;IDE;Java;

(where path_to_eclipse should be replaced by the path output of the which command used above. Or replace path_to_eclipse by eclipse and create a symbolic link to executable file pointed by the which command.) For example in your case, since the executable is /usr/share/eclipse.kepler/eclipse the .desktop file would look like this:

[Desktop Entry]
Type=Application
Name=Eclipse
Icon=eclipse
Exec=env UBUNTU_MENUPROXY=/usr/share/eclipse.kepler/eclipse
Terminal=false
Categories=Development;IDE;Java;

Now eclipse should appear in the menu.


To create a symbolic link use:

sudo ln -s -T source_file target_file

where you should replace source_file with the absolute path of eclipse and place the target_file i.e. the link in /usr/bin:

sudo ln -s -T path_to_eclipse /usr/bin/eclipse
  • This seems to be the same method provided by wilf, that didn't work. – Luís de Sousa Jan 19 '14 at 14:15
  • @LuísdeSousa, did you specify the absolute path of eclipse in the .desktop file's Exec entry?.. how do you start the application?.. what output did you get which eclipse command? – precise Jan 19 '14 at 16:19
  • ..did you get it solved @LuísdeSousa ? ..please share if you did. – precise Jan 21 '14 at 16:05
  • At this stage I'm only able to start Eclipse from the command line. which eclipse returns void. I have it installed in /usr/share. – Luís de Sousa Jan 21 '14 at 16:42
  • is the executable /usr/share/eclipse or something else ? – precise Jan 21 '14 at 17:15
1

I think that you are referring to Alacarte. For some reason, that does not always save the changes.

I would do as this answer suggests, but remember, even if you have no .desktop file for Eclipse, that this should do it for you:

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

enter image description here

And here is the properties window in case you don't believe me:

enter image description here

  • There is no eclipse.desktop file in my system. I thank the information but it is not really answering my question. Is this a bug with Alacarte? Can it be fixed? – Luís de Sousa Jan 19 '14 at 11:30
  • But gedit command will create it! Thats all you need to do! ;-) – Wilf Jan 19 '14 at 11:37
  • sudo touch /usr/share/applications/eclipse.desktop has not created a new entry in the Main Menu. I then copied in the contents proposed in the answer, but still no new item appears in the Main Menu. Please stick to the question. – Luís de Sousa Jan 19 '14 at 11:47
  • It should create a new entry, it will be under 'Other' - I'll add a picture... – Wilf Jan 19 '14 at 11:56
0

Try using this method https://askubuntu.com/a/80016/240859 to create launcher activator (you can then move it anywhere you like) but modify ~/.local/share/applications/opt_eclipse.desktop a little bit to make it look like:

[Desktop Entry]
Type=Application
Name=Eclipse
Comment=Eclipse Integrated Development Environment
Icon=<path to icon.xmp like /opt/eclipse/icon.xpm>
Exec=env UBUNTU_MENUPROXY=0  <path to eclipse like /opt/eclipse/eclipse>
Terminal=false
Categories=Development;IDE;Java;
StartupWMClass=Eclipse

Add env UBUNTU_MENUPROXY=0part. Don't forget modify paths in Icon and Exec.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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