Thursday, June 18, 2009

Java GUI really slow in VMWare guest?

I recently had to create a brand new VMWare guest for Windows XP. Until now I've held off running XP SP3 for various reasons, but for the sake of efficiency I installed this guest from an XP-SP3-VL ISO image.

After saving the base image I went and installed a test environment, which requires running a bunch of java GUI (and browser applet-based) programs simultaneously. For specific reasons, these versions are 1.3.1_06, 1.5.0_04, and 1.6.0_12. In testing this environment, I immediately noticed that any time a program was running in the JRE5 or JRE6 environment, the guest machine (and, to some extent, the host machine) became glacially slow. I'm talking "watch the guest screen repaint inch by inch" slow.

After various troubleshooting and, ultimately, reverting back to an SP2 bare image, it looks like *something* between SP2 and SP3 changed how video Hardware Acceleration behaves in Windows XP, at least inside VMWare, and this causes problems with how Java draws to the screen (well, modern versions at least -- 1.3.1_06 had no problems.) I am running VMWare Workstation 6.5 on a Windows XP SP2 host.

To solve this, do either of the following:
  • Turn Hardware Acceleration to None under Display Properties -> Settings -> Advanced -> Troubleshooting. Not recommended since presumably this is useful for other stuff.
  • Set the global environment variable "J2D_D3D=false" inside the guest OS. Using reskit tools this is "setx J2D_D3D false -m". According to Sun, this setting is used to turn off the Java 2D system's use of Direct3D in Java 1.4.1_02 and later.

I have not bothered figuring out what between SP2 and SP3 caused the problem on my system. I have not seen similar problems in my SP2 but otherwise fully up-to-date guest images on the same host. The key to the solution ultimately was found in VMWare community forums, but that thread discusses a different problem.

2 comments:

  1. Great post, many thanks. J2D_D3D=false has solved my issue although JRE caused screen "broking in colorful pieces" as described here: http://communities.vmware.com/message/1841996 instead of low performance (it was fine as far as I could tell).

    ReplyDelete
  2. Thanks for the comment. I haven't seen the problem in more recent versions of VMWare so I suspect the video hardware virtualization is much improved.

    ReplyDelete