Java crashing VMWare Fusion VM¶
It seems that something screwy is going on with VMWare Fusion 8 and Java 8 (1.8.0-66) with Windows 7 guests. I can't run any Java application, including the Java updater or Java config tools without the VM totally crashing, requiring me to reboot the OSX host in order to restart the VM. Very frustrating.
If I disable DirectX acceleration for the entire VM, Java works, but I need 3D acceleration for other things in the VM. The solution ended up being simple.
set the environment option _JAVA_OPTIONS as follows:
set _JAVA_OPTIONS=-Dsun.java2d.noddraw=true
Then run your java application. This disabled DirectX for the Java instance. Oddly enough, I could not get this option to get picked up when set in the "Configure Java" program.
Checking the Java Environment¶
my friend MathiasM on freenode provided a very simple test application that spits out the environment as Java sees it. Save the following as Test.java (yes capital T):
import java.util.Map;
public class Test {
public static void main(String[] args) {
for (Map.Entry<String,String> e : System.getenv().entrySet()) {
System.out.format("%s=%s\n", e.getKey(), e.getValue());
}
}
}
Compile it:
javac Test.java
And then run it:
java Test
It will spit out the environment and you will know immediately if your desired Java options are set:
Picked up _JAVA_OPTIONS: -Dsun.java2d.noddraw=true
If you don't have the JDK installed and only have the JRE like me, I've attached a precompiled .class file. As usual, use your judgement about running random binaries from the internet.