Seems there’s an assumption in Sun Java 1.5 about window managers which causes it to bug out with Compiz & Xgl.
A temporary workaround is:

export AWT_TOOLKIT=MToolkit

or grab Compiz CVS and apply the following patches:

— dix/window.c 2006/05/29 18:12:27 1.1
+++ dix/window.c 2006/05/29 18:15:15
@ -1265,8 +1265,12 @
result = EventSelectForWindow(pWin, client, (Mask )*pVlist);
if (result)
{
- error = result;
- goto PatchUp;
+ if (vmask Mask= SubstructureRedirectMask)
+ {
+ error = result;
+ goto PatchUp;
+ }
}
pVlist++;
break;

— src/window.c 6 Jun 2006 05:12:07 -0000 1.55
+++ src/window.c 6 Jun 2006 06:22:39 -0000
@ -2268,6 +2322,9 @
}

XConfigureWindow (w->screen->display->display, w->id, xwcm, xwc);
+
+ if (w->resName && strncmp (w->resName, “sun-awt-X11″, 11) 0) + sendConfigureNotify (w); } void @@ -2283,6 +2340,9 @@ XMoveWindow (w->screen->display->display, w->frame, w->attrib.x – w->input.left, w->attrib.y – w->input.top); + + if (w->resName && strncmp (w->resName, “sun-awt-X11″, 11) 0)
+ sendConfigureNotify (w);
}
}