Running Java 7 in an OS X 10.8 guest

Version 3

    There is a compatibility issue preventing the Java 7 runtime from launching on OS X platforms lacking hardware-accelerated OpenGL support, including OS X VMware virtual machines running on Fusion and ESXi.


    The script attached to this document applies a binary patch to liblwawt.dylib in the Java 7 Runtime Environment for Mac OS (the JRE) to address this specific problem.


    Installation instructions are included in this document.


    Environment: OS X 10.8 guest on VMware Fusion or ESXi, with Java 7 installed in the guest.


    Symptom: Java applications (including the Java Control Panel) fail to launch, with the guest OS presenting a dialog box such as:


         Java Control Panel quit unexpectedly while

         using the libjvm.dylib plug-in.


         Click Reopen to open the application again. Click Report

         to see more detailed information and send a report to



    The following text is present in the error report:


       Crashed Thread:  <nn>  Java: Java2D Queue Flusher


       Exception Type:  EXC_BAD_ACCESS (SIGABRT)

       Exception Codes: KERN_INVALID_ADDRESS at 0x00000000000003b0


    The crash occurs in function glGetString; That function name should be visible in the stack trace of the crashed thread.


    Cause: The JRE assumes that hardware-accelerated graphics are available.  Without hardware acceleration, no suitable pixel formats are found while initializing OpenGL.  This triggers a failure in the initialization of the CGLGraphicsContext, and a later attempt to query the graphics context by an indirect function call in glGetString fails due to the lack of a functional graphics context.


    Remedy: Removing the kCGLPFAAccelerated, kCGLPFAFullScreen and kCGLPFAPBuffer attributes from the pixel format request allows the software renderer to be used.  This patch modifies the method +[GraphicsConfigUtil _getCGLConfigInfo:] to alter the attributes it passes to -[NSOpenGLPixelFormat initWithAttributes:] accordingly.


    Installation: Copy the attached script into the affected virtual machine.  In the guest's Terminal, run


       sudo python ./


    Enter your password if prompted.  The script will respond with either an error message or an indication that the patch was successful.


    It should immediately be possible to launch Java content inside the virtual machine.  No reboot is required.


    It will be necessary to re-run the script after each Java update applied in the virtual machine.


    The script creates a backup copy of the file that it modifies.


    Disclaimer: This has only been lightly tested.  Feedback welcome!  It is possible that older or newer JRE versions might not be patchable with this script.


    Successfully tested with OS X 10.8.3 (12D78) and Java 7 Update 17 (build 1.7.0_17-b02).  Does not work for OS X 10.7.x guests at this time: The patch applies and prevents the crash, but Java windows/frames do not display any content.