2009-07-30

Java GUI application in Awesome Window Manager

There is a known problem with Java and the non-reparenting Window Managers like for example Awesome.
Java applications which use the XToolkit/XAWT backend may draw gray windows only. The XToolkit/XAWT backend breaks ICCCM-compliance in JDK 5 and 6 because it assumes a reparenting window manager.


There are a number of places where this is described:

To sum up:
  • it doesn't affect version Java 1.4.2 and before.

  • it doesn't affect version Java 1.7 and hopefully after.

  • the best workaround by far, is to set a name to the Window Manager, so it is recognise by Java as a non-reparenting Window Manager. A simple utility allow to set this name. Just add 'wmname LG3D' to your .xinitrc or simply run it.

  • Here are other workarounds left here for reference:

    • launch another X server, like Xephyr

    • set the following environment variable (to use the older Motif back-end instead): AWT_TOOLKIT=MToolkit. But this won't work in the following cases :
      • OpenJDK/IcedTea doesn't include the Motif toolkit.

      • doesn't work for x86_64 Java, for whatever reason.


2 comments:

Anonymous said...

Bruno, you are a lifesaver! Thank you for posting this workaround on my Docunext blog:

http://www.informedcoding.com/blog/2009/07/awesome-wm-java-guis.html

The ia32 / MToolkit workaround was still a little buggy on my AMD64 system. Yours is working like a charm. Thanks again.

Unknown said...

This tip is perfect Bruno! Once I compiled wmname and ran 'wmname LG3D' my windowed java application worked perfectly. My setup is amd64 ubuntu running the awesome window manager.

2023 summary

  Life is bigger than what you can imagine.  Still using Roam  http://www.roamresearch.com/  to take notes Still using Mastodon mainly, but ...