4

I thought this question fits SuperUser more than StackOverflow because it's not about actual Java programming, though programmers might be more likely to encounter the problem. Anyway, let me start of with some stats before I ask the actual question:

Laptop:

  • Windows 7 x32
  • Screen resolution 1024 x 768; Nvidia GeForce Go 6200
  • Connected to desktop via ad-hoc wireless network
  • Access internet via desktop

Desktop:

  • Windows 7 x64
  • Screen resolution 1920 x 1080
  • Connected to laptop via ad-hoc wireless network
  • Access internet via cable modem

I'm connecting to my laptop via Remote Desktop from my desktop to take advantage of the large screen. I'm doing programming on my laptop (for portability reasons). Everything else runs smooth and fast over Remote Desktop as both computers are connected directly over the ad-hoc wireless.

The only problem is this: Java Swing apps don't display the GUI properly. I acquired a Java Swing application and I'm debugging it in Eclipse. Here's what I got when I ran the app:

enter image description here

Apparently there doesn't seem to be anything wrong with the GUI application I'm debugging, because the Java Control Panel exhibits the same problem.

I've searched high and low in Google about this; the closest I came to a solution is this. But sadly, the use of -Dsun.java2d.nodraw=true has no effect at all.

This only happens over Remote Desktop. I have tried locally and the GUI apps display properly. This isn't a dealbreaker for me as I can stop using Remote Desktop when developing Java Swing apps. However, I would like to know if anyone has encountered this and found any solution.

PS: All software involved (Eclipse, Java JRE, etc.) are latest versions.

  • What settings are you using under display, experience, etc.. under options (Remote Desktop Connection)? – Rob Feb 12 '12 at 13:26
  • Thanks for the edit Journeyman Geek. @Mike: Full Screen, Highest Quality (32-bit), Audio transfer off, Device/Resource sharing fully off, High-speed broadband, Font smoothing, Desktop composition, Visual styles. (That's all) – ADTC Feb 13 '12 at 3:56
  • I haven't found a solution to rectify this, but upon further testing, I found that Java GUI apps work properly when I set the color depth to anything lower than "Highest Quality (32 bit)" (The available options are 24 bit, 16 bit and 15 bit.) Java has this problem only when I set the color depth to 32 bit. Could someone using Remote Desktop test this please to determine if it's a bug in Java VM? – ADTC Feb 14 '12 at 9:51
2

I can tell you that in the past I have had to set the color depth a little lower than the highest setting when viewing certain applications via remote desktop connection such as Eclipse.

In regards to a possible bug in the Java VM, refer to this answer for more information. I highly doubt this is the case since you haven't received any error messages pertaining to the inability of creating a Java Virtual Machine... but it's still worth checking out!

  • Strangely, Eclipse (Indigo SR1) seems to run just fine. I would still hold on to my speculation that this is a bug in Java VM because when the computer uses the RDP display driver in 32-bit color depth, this problem occurs, but when it uses the Nvidia display driver, it doesn't occur. Perhaps the JVM is having problems when interfacing with the RDP driver in 32 bit color (if anything of that sort actually happens), while no problem with 24 bit and lower? – ADTC Feb 14 '12 at 14:34
  • That doesn't surprise me (RDP vs. Nvidia), especially after comparing the specs of both display drivers. I think the issue with the JVM would be a memory issue but then again that's just speculation. Regardless, is everything operating properly now? – Rob Feb 14 '12 at 16:21
  • what do you mean "comparing the specs of both display drivers"? RDP display driver is not for any real hardware. It's a driver used by Windows (of remote client) when I log in to a remote desktop session. So I don't understand what you mean by specs of RDP driver. "is everything operating properly now?" No in 32 bit color depth. Partially yes in anything lower (as explained before). I want to use 32 bit color depth because the window frames switch to Basic theme in anything lower. PS: JVM doesn't complain of any memory deficit. It just screws up the Swing GUI. – ADTC Feb 14 '12 at 17:16
  • I was confused with your statements "when the computer uses the RDP display driver" and "when it uses the Nvidia display driver"... it sounded as if you were swapping them out or something. My bad. By specs I mean their capabilities. Nevermind my previous post, I misinterpreted your explanation. I'm going to continue researching and I'll let you know if I find anything. – Rob Feb 14 '12 at 18:31
  • Well, I haven't found anything. As stated before, I have been in situations (I also understand your disappointment) like this before and at the very least I knew my program was running properly when I turned down the settings on the depth. Sigh, I too really wish it would display properly when using higher settings. – Rob Feb 19 '12 at 20:08
6

I simply changed the color to 32 bit in both my desktop and RDP client and Java looked perfect.

6

I had the same problem and changing the color depth did not work for me. This:

-Dsun.java2d.d3d=false

seemed to work for me:

  • Not sure why this was downvoted. I just tried it because I was having the same issue and it fixed the problem. +1 from me – StormeHawke Dec 11 '13 at 20:29
2

I had a situation where my Java GUI would fail to paint completely, that is, all of the contents of the main window were stale and would not refresh when running on remote desktop.

Adding

-Dsun.java2d.d3d=false

also fixed it for me.

1

My same problem was fixed after I logged off windows and logged on again for the user connected to Remote Desktop (NOT merely disconnecting from Remote Dekstop).

1

I tried to start a Docker Image with auto install IntelliJ or Eclipse within the Container but i always got a blank content window for privacy, license and installation. I did this on a CentOS 7 Machine logged on via RDP Connection.

Then i saw that local installed Application OpenJdk Privacy Tool has the same problem, it starts but it does not show the content of the App, no buttons, no text...just a blank white screen.

I did search by google and find some workarounds which all does not help.

xhost + initx startx _JAVA_AWT_WM_NONREPARENTING=1 export DISPLAY=localhost:10.0 (and different more solutions around this)

I did try to install compiz and so on......nothing does help!

The Solution:

When connecting via RDP to the CentOS Machine set the Color max. Depth to High Color 16 Bit - not more (not 24 Bit, not 32 Bit)! Then you will see the content of such Apps/Programs using Swing / Awt / Java which has this content showing problem!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.