This wiki will shut down!

Please note that this wiki will be made read-only and eventually be taken offline.

A replacement is being discussed at We'd be happy to have more input for that discussion and volunteers who help us migrate the content of this wiki to its replacement.

Problems with Java

From awesome
Jump to: navigation, search

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.

Version 1.8[edit]

If you can't seem switch to a Java window using your keyboard, add the following to your rc.lua:

function delay_raise ()
   -- 5 ms ages in computer time, but I won't notice it.
   local raise_timer = timer { timeout = 0.005 }
			    if client.focus then
Then, replace all instances of
if client.focus then client.focus:raise() end
. Note that
has it formatted slightly differently.

Sun JVM[edit]

Netbeans' menus did not work all of the time unless I applied the nonreparenting windows fix:


JMenuBar shifted[edit]

You may experience shifted focus of JMenuBars, when using mouse. It can also appear as autoclick to the first menu item. It can be fixed with the following:

wmname Sawfish

Version 1.7[edit]

Sun JVM[edit]

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.

Recent Changes[edit]

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.

Multi-screen setup[edit]

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.

JetBrains IDEs[edit]

If you're experiencing any menu-related issues in JetBrain's IDEs, you can try disabling all other fixes and use this script with "Sawfish" instead of "LG3D" for IRONIC_WM_NAME. It may also help with other java issues, but i can't confirm it.

As of PhpStorm, it was fixed in EAP build 138.826.

Visual Paradigm[edit]

Setting the wmname to LG3D doesn't work with Visual Paradigm. However, it works with Sawfish:

wmname Sawfish

Versions 1.5 And 1.6[edit]

Use OpenJDK With Vendor Fix[edit]

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.


As of 17 September 2009, this patch has not been applied upstream by Sun Microsystems.

Impersonate Another Window Manager[edit]

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.

This does not work for awesome since 3.5, as the JMenuBar is not tracked. The solution is to impersonate Sawfish using

$ wmname Sawfish

Use Legacy, Motif-based Integration[edit]

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.


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.

Version 1.4[edit]

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.