Java swing applications not rendering properly with VNC
Asked Answered
C

4

8

Swing applications show a blank window when launched on a VNC desktop with Java 8. I don't have this problem with JRE 7 and non-swing applications (eg. Eclipse) runs properly with the same settings.

Are there some sort of default settings like 3D acceleration or something that have been enabled by default on JRE 8 ? How does i disable it ?

Chiffon answered 7/3, 2016 at 19:42 Comment(1)
For the record: the problem only occurs with Java 8. Tested with Java 9 and 11.Lens
C
8

On a Linux system, I've found that using the -Dsun.java2d.xrender=false option solved the issue. I think that xrender is now enabled by default on Java 8.

System Properties for Java 2D can be found here : http://docs.oracle.com/javase/8/docs/technotes/guides/2d/flags.html

Chiffon answered 26/3, 2016 at 12:21 Comment(0)
N
20

TL;DR

  • Java and glxgears expect a color depth of 24.
  • Make sure that X and VNC are set to use a depth of 24 and not some other depth like 16 or 32.

Details:

I had blank Java windows in VNC too, but with Java 7 and Java 8, so it wasn't much of a surprise that disabling xrender didn't help me. That probably makes it a gross violation of StackOverflow protocol to post this here, but I found my way here, so surely others will too. -Dsun.java2d.opengl=true made the text visible, though the anti-aliasing was like something out of the 1980s with a messed up palette, but then I got spuriously transparent parts of windows, always the same parts, cleanly composited, so not like a driver bug. Noticing that glxgears was also displaying with a neat transparent background, when it's opaque black on other systems, I found a thoughtful and informative bug report against "compton", RGBA windows are always transparent #179. Inspired to look at xdpyinfo, I found my VNC server was offering "visuals" of depth 32 only, ie visuals with 8 bits each of red, green and blue and eight bits of alpha. It seems Java, and glxgears, want an opaque visual, so one of depth 24. My normal :0 X server has that as its default. For the -depth switch, man Xtigervnc says "Default is 24, other possible values are 8, 15, and 16 - anything else is likely to cause strange behaviour by applications", yet Debian's provisional packaging for TigerVNC, specifically in /etc/vnc.conf and /usr/bin/tigervncserver, sets it to a default of 32. -depth 24 and suddenly everything was beautiful again, with translucency only where it was requested. xdpyinfo revealed many "visuals" on offer, including depth 32.

Numismatics answered 25/5, 2016 at 5:12 Comment(4)
I was having trouble running OWASP ZAP on a Kali box in a tigervnc session - the windows kept coming up empty. Editing /etc/vnc.conf to change the default depth from 32 to 24 fixed it. Thanks, Martin!Talanta
Thanks Martin! I invested half a day on this **** error. Your post saved me!Pileum
The same problem occurs in XRDP. Edit xrdp.ini (/etc/xrdp/rxrdp.ini) and include 'xserverbpp=24' into the [Xvnc] and [Xorg] configurations.Hare
I'm a noobie. How do I change it in RHEL 7? I'm not sure where tigervnc config file and xrdp config files areGarland
C
8

On a Linux system, I've found that using the -Dsun.java2d.xrender=false option solved the issue. I think that xrender is now enabled by default on Java 8.

System Properties for Java 2D can be found here : http://docs.oracle.com/javase/8/docs/technotes/guides/2d/flags.html

Chiffon answered 26/3, 2016 at 12:21 Comment(0)
G
3

On Red Hat Enterprise Linux there were two settings in the /etc/xrdp/xrdp.ini file:

uncommented: serverbpp=24 changed existing item: max_bpp=24

Garland answered 4/2, 2020 at 19:23 Comment(1)
I had this issue with MPLABX ide/ipe also on fedora 32, it would load with a blank/white screen. After many weeks I came across this fix, thanks for sharing.Doited
W
0

I encountered this problem today after upgrading JetBrains pycharm to the 2019.x.x version (tried several of them).

Unlike the above, I was configured for 16 bit depth on both the vnc client and server which resulted in a red window with no text displayed when I started the upgraded pycharm (older 2018 versions worked fine).

Switching both the client (remmina - edit the individual connection configuration) and the server (tigervncserver / Xtigervnc) to 24 bit depth solved the problem for me.

Worn answered 22/11, 2019 at 13:29 Comment(1)
is it a question or what ?Faery

© 2022 - 2024 — McMap. All rights reserved.