The website has moved

Note: the website moved to www.keenformatics.com. You're being redirected.

Monday, November 4, 2013

How To show Eclipse menu in Ubuntu 13.10 Saucy Salamander

Note: The following solution also applies to Aptana Studio.

The almost new Eclipse Kepler IDE has been released with a new exciting bug for those who use Ubuntu 13.10 (Saucy Salamander).

If you're among those lucky developers, when you'll open your IDE you'll find that Eclipse upper menu is pretty useless, since clicking on menu entries nothing will happen: no submenus will show up as you expected.

So, what to do if Eclipse menu doesn't show up in Ubuntu 13.10? The best solution at the moment (until someone decides to fix this bug) is the following.




N.B.: This method takes for granted that you already created your eclipse.desktop file. If you didn't create it and you don't want to do that at the moment, you can simply run eclipse by console with this command:

$ UBUNTU_MENUPROXY= eclipse
where "eclipse" is the path to your eclipse executable. But this is just the fast way to run eclipse once. If you don't want to remember this command and use it every time you have to run Eclipse, follow the rest of this guide.

Steps!
  1. Open your eclipse.desktop file:
    sudo gedit /usr/share/applications/eclipse.desktop
    or
    sudo gedit ~/.local/share/applications/eclipse.desktop
    (Depending on your configuration.)
  2. Copy these lines in it:
    [Desktop Entry]
    Type=Application
    Name=Eclipse
    Icon=eclipse
    Exec=env UBUNTU_MENUPROXY= eclipse
    Terminal=false
    Categories=Development;IDE;Java;
    
  3. Save the file.

Yes, that's it. Did you expect something harder? Comment complaining is welcome.

If you found this post useful, please share it!

References

18 comments:

  1. This has been plaguing me for hours. I'm a new venturer into the world of Linux, so all of this is new to me.

    I didn't have an eclipse.desktop file in that folder. I tried using sudo find to see if there is one elsewhere on my system. There isn't one. Why is this? Why is there non-persistent behaviour between two setups? I didn't do anything special in my installation in Ubuntu, and I just unzipped Eclipse into a folder. Why are their differences?

    So, anyways, I tried creating the file, pasting in the above, and running eclipse. Menus still don't work.
    I tried changing

    Exec=env UBUNTU_MENUPROXY= eclipse

    to

    Exec=env UBUNTU_MENUPROXY= /home/samuel/Dev/eclipse

    As this is the path to Eclipse, still didn't work

    Exec=env UBUNTU_MENUPROXY= /home/samuel/Dev/eclipse/eclipse

    So, pointing to the actual file... still nothing.

    What else am I doing wrong?

    Sorry if I sound arsey, this whole thing has been a real pain. First I was having all-manner of problems with my graphics drivers, then issues with my monitor because it wasn't reporting its resolutions correctly, then I had the dismay of discovering the lack of decent SVN clients, now I'm having problems with Eclipse!

    I blame myself and my ignorance, but my patience is wearing a bit thin. Please point me in the right direction. Thank you.

    ReplyDelete
    Replies
    1. Hi Samuel.
      After you create your eclipse.desktop file, you should be able to find Eclipse if you search for it from your Ubuntu launcher. Running it from Ubuntu launcher should bring your menu entries back.

      Make sure that your "eclipse" executable file is actually the one at /home/samuel/Dev/eclipse/eclipse path (try running it by console). Note that if you try to run it by console without specifying the "UBUNTU_MENUPROXY=" prefix you won't get your menu entries back, since you're not using the eclipse.desktop file. This file, actually, is used only when you run Eclipse from your ubuntu launcher.
      If you want your menu fixed running eclipse by console, you should run this command instead:

      UBUNTU_MENUPROXY= /home/samuel/Dev/eclipse/eclipse

      Let me know :)

      Delete
    2. @ Samuel: In regard to eclipse.desktop file, the fact that you don't have it on your system is normal, since you downloaded something like a standalone eclipse version: all you have done, in fact, has been unzipping it into a folder, as you said. This means that you didn't set any particular interaction between Eclipse and your Ubuntu environment.

      On the other hand, when you install programs using (e. g.) .deb files, or other software installation packages, they automatically manage all the dependencies your system needs to run the program (often including .desktop files).

      Delete
    3. Thank you for your time

      Unfortunately, it's still not working, even if I run from the launcher (the launcher is the equivalent of the dock/start bar, right?).

      Going into console and running /home/samuel/Dev/eclipse/eclipse launches eclipse, so it's definitely the right path

      Inside my eclipse.desktop, I have this:

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

      And it's in this location:

      /usr/share/applications/eclipse.desktop

      I was going to install the version on the Ubuntu Software Centre, but I noticed it's an outdated version, would I have had the same problems?

      Delete
    4. Yes, the launcher is the equivalent of the start bar, and you can use it to search for you applications.
      This is my eclipse.desktop file:

      [Desktop Entry]
      Name=Eclipse
      GenericName=IDE
      Exec=env UBUNTU_MENUPROXY= /usr/bin/eclipse
      Terminal=false
      Type=Application
      Categories=IDE;
      Icon=/usr/share/app-install/icons/eclipse.xpm
      StartupNotify=false

      As you can see, the exec path is different, but the result should be the same since i'm just pointing to a symbolic link to the real eclipse file (which is in my eclipse installation folder, as yours).

      Try to run from console:
      env UBUNTU_MENUPROXY= /home/samuel/Dev/eclipse/eclipse

      I think that even the Ubuntu Software Center versions would easily be affected by the same issue, since it seems to be an Ubuntu 13.10 problem, and not an Eclipse problem.
      Try to run that console command and tell me what happens :)

      Delete
    5. If you're wondering about the Icon path: I simply copied my eclipse icon (you can find it in your eclipse installation folder) and pasted it in /usr/share/app-install/icons folder.
      You can do the same if you want, but I think that the result should be the same even if you simply use the original eclipse icon path. You could give a try adding that icon path to eclipse.desktop.

      Delete
    6. Woo, running from the console has the expected results (menu bar as part of the window's frame).

      I don't know why, but it seems like that eclipse.desktop file is not being launched when I run Eclipse. Is there a setting somewhere where I can set where Ubuntu/Eclipse looks when this file is launched (I've seen it mentioned that eclipse.desktop is sometimes in a different folder... is it possible that my setup is looking for the .desktop file in a different folder?)

      Thanks for your help, btw! Not everyday you see people going this much out of their way for a complete stranger

      Delete
    7. I'm glad you found a way to get it work :)
      You can try to locate your system .desktop files, so that you'll find where they actually are. To do this, you can try these commands in console:

      sudo updatedb
      sudo locate .desktop


      The first one updates the "locate" database, while the second one returns all the search results.
      You can also try to copy the content of one of those files and paste it in your eclipse.desktop, editing the different paths.
      (Thank for your kind words. You'll always be welcome here :) )

      Delete
    8. @SamuelRSmith, did you managed to find a solution ?? i have the same problem as you from command line its working but the .desktop file is not !!!

      Delete
  2. I am not able to get the drop down menu either. The only to get the drop down menu is to launch the application via root access in the terminal, but I don't see as a long term solution.

    Below is my desktop file:

    [Desktop Entry]
    Type=Application
    Name=Eclipse
    Comment=Eclipse Integrated Development Environment
    Icon=eclipse
    Exec=env UBUNTU_MENUPROXY= /home/francis/Downloads/eclipse
    Terminal=false
    Categories=Development;IDE;Java;

    ReplyDelete
    Replies
    1. Hi boyshawn. Did you try to run eclipse from terminal without root access?

      UBUNTU_MENUPROXY= /home/francis/Downloads/eclipse

      What happens when you do so?

      Delete
  3. I have the same problem, can run UBUNTU_MENUPROXY=/home/nicholas/Downloads/eclipse/eclipse and have it run fine, but no matter the contents of my eclipse.desktop file, I still don't get menus when I launch it from the launcher. Any help?

    ReplyDelete
    Replies
    1. .desktop files are located in /usr/share/applications (globally) or in ~/.local/share/applications (locally). You could try to put your eclipse.desktop in the local path and see if it works. You could also try to make the file executable and drag it on the launcher.

      To make a file executable use this terminal command from inside its folder:
      sudo chmod +x eclipse.desktop

      Delete
  4. I created the file in /usr/share/applications but that didn't get picked up. After running:

    sudo updatedb
    sudo locate .desktop | grep eclipse

    i found a file in ~/.local/share/applications and edited that one with the changes described in the post, and now it works :-)

    ReplyDelete
    Replies
    1. I edited the post to add the local path :)

      Delete
    2. it worked with me for the local path when i give the complete path also

      Delete
    3. Very good
      Thanks a lot.
      It works fine creating the eclipse.desktop with root privileges (sudo gkedit or so) in
      ~/.local/share/applications including the line with the
      Exec=env UBUNTU_MENUPROXY= /home/masterbd/eclipsek/eclipse
      and after, giving permission for execution.
      Performing that, you can launch it, and set a link on the desktop or application launcher.

      Delete
  5. For ones that tried all without successfully, try out this from a command line:

    export UBUNTU_MENUPROXY=0

    Then, navigate to a eclipse installation folder and launch eclipse normally from the same command line:

    ./eclipse

    This works for me!
    ___________________
    Best Regards. JAngel
    Contact: jgarcia@tamps.cinvestav.mx

    ReplyDelete