How to create a Menu item for Eclipse in Ubuntu 13.10?
Solution 1
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.
Solution 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
Solution 3
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
And here is the properties window in case you don't believe me:
Related videos on Youtube
Luís de Sousa
Member of the PyWPS Project Steering Committee; Charter Member of the OSGeo Foundation. Unix/Linux user since 1996. Experiencing Ubuntu since 2007, using it as main OS at home and office since 2009. Check my projects at Codeberg. More about what I do is in my personal web site. Follow me at Mastodon.
Updated on September 18, 2022Comments
-
Luís de Sousa over 1 year
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: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?
-
Luís de Sousa over 10 yearsThere 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? -
Wilf over 10 yearsBut
gedit
command will create it! Thats all you need to do! ;-) -
Luís de Sousa over 10 years
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 over 10 yearsThis seems to be the same method provided by wilf, that didn't work.
-
precise over 10 years@LuísdeSousa, did you specify the absolute path of
eclipse
in the.desktop
file'sExec
entry?.. how do you start the application?.. what output did you getwhich eclipse
command? -
Luís de Sousa over 10 yearsAt this stage I'm only able to start Eclipse from the command line.
which eclipse
returns void. I have it installed in/usr/share
. -
precise over 10 yearsis the executable
/usr/share/eclipse
or something else ? -
Luís de Sousa over 10 yearsThe executable is
/usr/share/eclipse.kepler/eclipse
. -
precise over 10 years..and even including this path in .desktop file didn't work, or else?
-
Luís de Sousa over 10 yearsApparently the
eclipse.desktop
file is being ignored by Alacarte, or whatever software that manages the menus. -
falconer over 10 years@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 over 10 years@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 over 10 years@LuísdeSousa It is also possible that you already have an eclipse.desktop file in
~/.local/share/applications/
in which case that .desktop file takes precedence over the/usr/share/applications/eclipse.desktop
desktop file, and the latter is not shown anywhere. This can be a cause, but that would mean someone put an eclipse.desktop file into~/.local/share/applications/
. -
falconer over 10 years@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. -
Luís de Sousa over 10 yearsHi again falconer. There was no
eclipse.desktop
in~/.local/share/applications/
so I just copied there the one in/usr/share/applications
and log out. After logging in Eclipse is now finally showing up in the Dash and in Alacarte. This is mighty weird but indeed answers my question. Please add these comments to your answer so I can accept it. Any idea why the.desktop
file in/usr/share/applications
is being ignored? Thanks. -
falconer over 10 years@LuísdeSousa I don't know why it doesn't show up from there. I put a .desktop file in my
/usr/share/applications
dir with the same contents as yours in the question, and it showed up immediately. You may try to test whether if you rename that .desktop file from eclipse.desktop to e.g. aaabbb.desktop make it show up. My only clue is this, that there is a naming conflict somewhere.