<html>
  <head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <p>After the last Matlab upgrade I found that the Matlab desktop GUI
      was barfing out with X errors and hanging X2go at a rate that made
      it completely unusable.  Possibly this only happens with windows
      x2go because predrag was unable to reproduce it.  Anyway, via the
      wonders of Google and stackexchange I have found a partial
      workaround.</p>
    <p><a class="moz-txt-link-freetext"
href="https://stackoverflow.com/questions/34188495/how-can-i-work-around-the-classcastexception-in-java2d-bug-id-7172749">https://stackoverflow.com/questions/34188495/how-can-i-work-around-the-classcastexception-in-java2d-bug-id-7172749</a></p>
    <p><a class="moz-txt-link-freetext"
href="https://www.mathworks.com/help/matlab/matlab_env/java-opts-file.html">https://www.mathworks.com/help/matlab/matlab_env/java-opts-file.html</a></p>
    <p>It seems that in Java 8 a display optimizer called Java2d has now
      been enabled by default.  This is (mostly) where Matlab was having
      problems in my environment.  You can turn this off by creating a
      file java.opts with this line in it:</p>
    <p><code>-Dsun.java2d.xrender=false</code> </p>
    <p>This file has to be in the directory that you start Matlab from
      (Matlab startup directory).</p>
    <p>If other people are having this problem, we may want install this
      in the Matlab root, as described in the second link.</p>
    <p>I am still seeing a new null pointer exception failure in event
      dispatching, but this is nonfatal.</p>
    <pre>Oct 10, 2017 1:10:48 PM sun.awt.X11.XToolkit processException
WARNING: Exception on Toolkit thread
java.lang.NullPointerException
        at sun.awt.X11.XWindowPeer.stateChanged(XWindowPeer.java:1462)
        at sun.awt.X11.XWindow.handlePropertyNotify(XWindow.java:1284)
        at sun.awt.X11.XComponentPeer.handlePropertyNotify(XComponentPeer.java:75)
        at sun.awt.X11.XBaseWindow.dispatchEvent(XBaseWindow.java:1143)
        at sun.awt.X11.XBaseWindow.dispatchToWindow(XBaseWindow.java:1086)
        at sun.awt.X11.XToolkit.dispatchEvent(XToolkit.java:502)
        at sun.awt.X11.XToolkit.run(XToolkit.java:616)
        at sun.awt.X11.XToolkit.run(XToolkit.java:532)
        at java.lang.Thread.run(Thread.java:745)

</pre>
    <p>  Rob</p>
    <p><br>
    </p>
  </body>
</html>