Problems with Java
The X Window System integration in most modern implementations of the Java virtual machine (JVM) displays only empty, gray windows when used with many non-re-parenting window managers, such as Awesome. This is almost certainly a violation of ICCCM and has been reported to Sun Microsystems a number of times.
Although lots of java applications seem to work fine, at least the intellij and netbeans versions as of 2011-11-21 don't seem to work.
Intellij and netbeans work with the fix described below. Most other java apps seem to work fine even without the fix.
As of Java 1.7 and Awesome 3.5 the fixes described below may actually cause undesirable behaviour related to menus. Awesome is now, apparently, a reparenting window manager as of this commit. If you are experiencing problems having applied the 'wmname' and '_JAVA_AWT_WM_NONREPARENTING' fixes against a recent Java and Awesome try removing both fixes.
This behaviour was observed with the awesome-git package in Arch Linux as of 2013-07-14.
As of 2014-01-24 there are still ongoing problems with some Java Swing applications, in particular with respect to multiple monitors and the rendering of drop-down menus. The best current workaround at present seems to be to make these windows floating. A bug report has been filed and is tentatively projected to be fixed in release 3.5.3.
It might work if you launch your java application with '_JAVA_AWT_WM_NONREPARENTING' environment variable set on the first (as defined in your X11/Xorg configuration file) screen.
Versions 1.5 And 1.6
Use OpenJDK With Vendor Fix
The versions of OpenJDK that ship with some operating system distributions—at least Debian (and Ubuntu) and Arch Linux in March and August of 2009, respectively—have had this problem fixed by the vendors. Just set the environment variable
_JAVA_AWT_WM_NONREPARENTING to any value to inform the JVM that your window manager does not re-parent.
$ _JAVA_AWT_WM_NONREPARENTING=1; export _JAVA_AWT_WM_NONREPARENTING
As of 17 September 2009, this patch has not been applied upstream by Sun Microsystems.
Impersonate Another Window Manager
You may use the
wmname utility to make the JVM believe you are running a different window manager. This utility is available in the
suckless-tools package in Debian (and Ubuntu); this Portage tree provides
wmname for Funtoo (and Gentoo).
$ wmname LG3D
(You must restart the application in question after issuing the wmname command.)
This works because the JVM contains a hard-coded list of known non-re-parenting window managers. For maximum irony, many users prefer to impersonate “
LG3D,” the non-re-parenting window manager written by Sun, in Java.
Use Legacy, Motif-based Integration
The Motif-based X integration used in older versions of the JVM does not have the particular problem of empty, gray windows, though it may have other bugs and is no longer actively developed. To use the Motif-based X integration, set the environment variable
AWT_TOOLKIT to the value
MToolkit. This is the solution described in Awesome’s manual page.
$ AWT_TOOLKIT=MToolkit; export AWT_TOOLKIT
Be warned that the Motif X integration is absent from free software JVMs such as OpenJDK and IcedTea, and it has at least one known crashing bug on AMD64.
Versions 1.4 and earlier of the JVM’s X integration are based on Motif and are not known to have the problem described here. Of course, this version of the JVM has not been supported by any major vendor for some time, so using it likely comes with other hazards.