Eclipse IDE’s Ubuntu Integrated Menus Hack

Eclipse
Eclipse Icon
 Eclipse IDE is blacklisted in the general application menu library (libappmenu.so) in Ubuntu- as well as other applications like EMACS editor and Lotus Note -. We don’t know exactly why! But it seems Eclipse could show corrupted menus (disordered menus, missing menus, duplicate menus…). Real technical explanations are not yet provided. At lease for Emacs IDE, we know that when integrated to Global Menu, dynamically created menus do not integrate (try to same procedure below for Emacs – replace emacs23 by Xemacs23 – and you would notice that sh-Script menu is lost).
As a matter of fact, when you open Eclipse IDE, menus are not integrated in top panel, and one cannot use HUD for Eclipse neither. For developers who migrated from Mac Os to Ubuntu Unity, this could feel ugly. For the time being, there is a hack that enables integration of Eclipse IDE’s menus in Unity top panel, and as far as we can tell, there is no downside until now. However, feel free to report if any!


Ubuntu 13.10 BUG:

Due to recent updates in global menu proxy and libraries in Ubuntu 13.10, Eclipse menu cannot be integrated, so for now you just switch the global menu proxy off untill the bug is fixed:

– Open the desktop file for eclipse : gedit /usr/share/applications/eclipse.desktop or gedit ~/.local/share/applications/eclipse.desktop

– in the exec path, append at the beginning of the value, the following instruction : env UBUNTU_MENUPROXY=0

Example: Exec=env UBUNTU_MENUPROXY=0 /home/hanynowsky/eclipse/eclipse

This will disable global menu integration for eclipse.

Do as such for any other application that suffers from poor menu integration.

For Ubuntu 12.04 and 12.10 The HACK is what follows:

1- Install EMACS editor if not yet done :

sudo apt-get install emacs

2- Open the Application menu library using Emacs (Backup the file before, in case you accidently screw things : ex:  sudo cp /usr/lib/gtk-2.0/2.10.0/menuproxies/libappmenu.so ~/Desktop):

sudo emacs /usr/lib/gtk-2.0/2.10.0/menuproxies/libappmenu.so

3- Click EDIT in Emacs menu, and choose SEARCH.

4- Search for : Eclipse

5- Replace E by X so that Eclipse becomes Xclipse.

6- Click FILE then SAVE

7- Exit Emacs.

8- Open Eclipse. You’re done.

– Due to recent updates on Ubuntu 12.1O, the command to enable Global Menu for Eclipse in 12.10 is the following:

cd /usr/lib/x86_64-linux-gnu/gtk-2.0/2.10.0/menuproxies && sudo sed -i 's/Eclipse/Xclipse/' libappmenu.so

This hack works fine for Eclipse Indigo & Juno under Ubuntu 12.04 & 12.10.

The result should look like this:

Eclipse Integrated Menus in Unity
Eclipse Integrated Menus in Unity
Unity HUD for Eclipse
Unity HUD for Eclipse

This is actually part of bug report in Launchpad:Please join this bug

Published by Hanynowsky

Mere human being!

46 thoughts on “Eclipse IDE’s Ubuntu Integrated Menus Hack

  1. If I use Eclipse 4.2 (Juno) and Ubuntu 12.04 this hack doesn’t work. If you set this, Eclipse 4.2 won’t start:

    #
    # A fatal error has been detected by the Java Runtime Environment:
    #
    # SIGSEGV (0xb) at pc=0x00007fd3d5172be2, pid=15021, tid=140547791968000
    #
    # JRE version: 7.0_06-b24
    # Java VM: Java HotSpot(TM) 64-Bit Server VM (23.2-b09 mixed mode linux-amd64 compressed oo
    ps)
    # Problematic frame:
    # C [ld-linux-x86-64.so.2+0xbbe2] _dl_rtld_di_serinfo+0x2cc2
    #
    # Failed to write core dump. Core dumps have been disabled. To enable core dumping, try “ul
    imit -c unlimited” before starting Java again
    #
    # An error report file with more information is saved as:
    # /opt/eclipse/hs_err_pid15021.log
    #
    # If you would like to submit a bug report, please visit:
    # http://bugreport.sun.com/bugreport/crash.jsp
    # The crash happened outside the Java Virtual Machine in native code.
    # See problematic frame for where to report the bug.
    #

    Any ideas?

    1. Weird. Normally it works. See the latest post by Erutulco. Might be related to your JDK/JRE not the hack.
      Are you sure you did exactly what’s in the post? A friend of mine has the same Eclipse as you and it works fine.
      I read your error messages and it seems related to Java VM Env not the hack itself.

  2. I got it. It is very important, that you don’t change the length of the word ‘Eclipse’ in the *.so file. That means, a replacement to ‘backup_Eclipse’ will NOT work (you wrote it above, but I didn’t think it was important 😉 )! Thanks for your great help here!

  3. I think I know why eclipse was blacklisted in libappmenu – I’ve found that when using eclipse with the integrated menus, sometimes duplicate menu entries appear in the menu bar. Presumably the devs couldn’t fix this in time for release and so it was blacklisted.

    Not a big deal, but definitely a bug.

    1. Yeah thanks for confirming. There is a smiliar bug with the lastest LibreOffice (Menu disappears). As you said not a big deal. Devs are aware of this and bug is triaged I think.

  4. This worked perfectly fine for me with Ubuntu 12.04, but since I upgraded to Ubuntu 12.10, it does’t change anything no more. No AppMenu, no HUD for me. Any ideas?

    1. Well, it worked for me with a new build – I can’t see why an upgrade should be that much different.

      1. As the version of Eclipse in the repositories of Ubuntu 12.04 was an old one, I installed it manually by ectracting the Eclipse for Java developers 64bit bundle to /opt

        1. I don’t see any other explanation but the fact that /usr/lib/gtk-2.0/2.10.0/menuproxies/libappmenu.so was overwritten (updated) during 12.10 upgrade. Redo the hack above again. And tell us if it’s okay.

          1. Well, the point is that this isn’t the fact. In my libappmenu.so, it still says “Xclipse” and there is no trace of any “Eclipse” in there.

  5. I’ve updated Ubuntu 12.04 today and no more working. The file /usr/lib/gtk-2.0/2.10.0/menuproxies/libappmenu.so no longer exists

    1. Due recent updates in 12.10, libappmenu.so no longer exists in the menuproxies folder.
      It moved to : /usr/lib/x86….
      See post above with updated information. cheers.

  6. Success with updated command line on Kubuntu 12:10 KDE 4.10.00 & Eclipse Juno 4.2.2 Build id: M20130204-1200. Menus look great, have not seen any problems. Now if I could just figure out how to enlarge the microscopic toolbar icons! …gettin’ radiation burns on my nose trying to see them…

    1. I see. Happy to hear it!
      Personnaly, the icons size do not bother me. And unlike Netbeans, you can’t change toolbar icons size as far as I can tell.
      find /path/to/your/eclipse/ | grep .png
      Use the above command to find folders where icons are stored and change what you can.
      Maybe these references may help:
      http://www.vogella.com/articles/Eclipse4CSS/article.html
      and
      http://ranvijay.wordpress.com/2009/08/24/eclipse-on-ubuntu-changing-the-icon-and-font-size/

  7. Thank you; I had read somewhere else (really need to keep track of these things) that the first Icon of each toolbar determines the size. I tracked down the ‘new_wiz.gif icon’ and made it 32×32 instead of 16×16 and that toolbar is now larger! Just need to go through and pull in KDE 32×32 action Icons to replace the Eclipse defaults and I will have Eclipse well integrated, at least visually, with my KDE desktop. 32×32 might sound large but on a 2560×1440 monitor 16×16 is just too small. Guess I should get motivated and make a theme, but looks like toolbar icons would still have to be manually replaced.

  8. awesome…but my libappmenu.so was in another folder
    /usr/lib/i386-linux-gnu/gtk-2.0/2.10.0/menuproxies/libappmenu.so
    it takes a minute to find it, but now, it works.. great

  9. Just like Stefan said above: In Ubuntu 13.04, the “old” way (with emacs) works finde. But libappmenu.so is placed either in “/usr/lib/i386-linux-gnu/gtk-2.0/2.10.0/menuproxies/” or /usr/lib/x86_64-linux-gnu/gtk-2.0/2.10.0/menuproxies/”, depending on your architecture.

  10. I was wondering if you ever considered changing the page layout of your site?
    Its very well written; I love what youve got to say.
    But maybe you could a little more in the way of content so people could
    connect with it better. Youve got an awful lot of text for only having one or two pictures.

    Maybe you could space it out better?

    1. Thanks for this remark! Indeed, the layout is not the best in the world. I am using the free version of WordPress so I have just a set of standard CSS Templates to use. I wish I could have more control on the CSS template. I digged once to see if I could directly use my own CSS but that requires a paid upgrade. I am thinking about migrating this blog to my own hosted WordPress blog in the near future and I have personal layouts to use 🙂 Meanwhile! I’ll change the layout to something else from the standard ones to see if that relatively responds to your request! Thank you for your valuable feedback. 🙂

  11. Very useful, this gave me the hint to better integrate IBM Notes 9 in Ubuntu 12.04. I replaced Notes with Xotes in /usr/lib/i386-linux-gnu/gtk-2.0/2.10.0/menuproxies/libappmenu.so:

    – First off find out which applications use the library with “lsof /usr/lib/i386-linux-gnu/gtk-2.0/2.10.0/menuproxies/libappmenu.so” and close them.
    – Now run:
    sudo cp -a /usr/lib/i386-linux-gnu/gtk-2.0/2.10.0/menuproxies/libappmenu.so /usr/lib/i386-linux-gnu/gtk-2.0/2.10.0/menuproxies/libappmenu.so.orig-notes_blacklisted
    sudo bash -c “^Cd ‘s/Notes/Xotes/’ /usr/lib/i386-linux-gnu/gtk-2.0/2.10.0/menuproxies/libappmenu.so”

    and no problems so far!

    1. Sorry for the typo:
      sudo bash -c “^Cd ‘s/Notes/Xotes/’ /usr/lib/i386-linux-gnu/gtk-2.0/2.10.0/menuproxies/libappmenu.so”
      should be:
      sudo bash -c “sed ‘s/Notes/Xotes/’ /usr/lib/i386-linux-gnu/gtk-2.0/2.10.0/menuproxies/libappmenu.so”

  12. Fun fact, in 13.10 (Saucy Sonofabitch Salamander) libappmenu.so no longer has the blacklist, it’s been moved to the unity-gtk2-modules and unity-gtk3-modules packages’ libunity-gtk-module.so (/usr/lib/x86_64-linux-gnu/gtk-2.0/modules .. and the …/gtk-3.0/.. one)

    Though editing it doesn’t work neither with Eclipse 4.4 (Luna) nor with 4.3 (Kepler) for some reason. (But hitting Alt-F brings up the File menu, then one can move with the left-right arrows between the menus. But I’m guessing it’s a bit different bug/phenomenon, because I don’t even have non-global unity-integrated menu bar.)

    1. Thanks for the hint! I still haven’t tested 13.10. I am amazed how they changed things in 13.10 😦
      Personally I cannot stand Eclipse without global menu integration. You can also meanwhile use JBoss Eclipse Developer Studio 6.0 GA which is Eclipse with additional packages like JBoss Tools. You would have Global Menu right away and it’s free.
      We’d probably find some way to enable global menu for Eclipse 4.4 in 13.10 before its release 🙂 Keep searching by your side. Once I find something I’d post it .
      Cheers!

      1. The strange thing is, that on my fully upgraded 13.10 menu is broken on both 4.3 and 4.4 (the global menu is there, but nothing drops down, and Alt-F makes a naked menu appear at the upper-left corner of the Eclipse window), but I did a complete reinstall on a laptop (from the same pendrive!) and fully dist-upgraded it, but there the global menu blacklist is working as intended, so I have a menubar inside the window, but at least that works (tried on 4.3).

        Quite a bug, huh? (I’ll try editing the blacklist on this new install and report back.)

  13. Does anybody have a workaround for 13.10 Saucy? After a clean install global menus didn’t work but the menus did. If I modify /usr/lib/x86_64-linux-gnu/gtk-2.0/modules/libunity-gtk-module.so and /usr/lib/x86_64-linux-gnu/gtk-3.0/modules/libunity-gtk-module.so and do Eclipse->XEclipse then I have the same problem as described in the ticket (https://bugs.launchpad.net/eclipse/+bug/618587) where the top menus are global menus, but they don’t work (i.e. don’t drop down). Using the “export UBUNTU_MENUPROXY=0” workaround simply gives me back a non-global menu that is working.

Leave a reply to Štefan Cancel reply