The final word on Google Eclipse plugin OSX crashes
permalinkI’ve blogged about the subject of GWT JVM crashes far too much (here and here). This is, I hope, the final word on the subject. I spent some time disassembling the Google Eclipse plugin (did I agree not to do that in one of the EULAs? ;)) and discovered that they are launching the JVM without using the Eclipse infrastructure. This means that the JVM arguments are effectively hardcoded, except in one case where -startOnFirstThread is passed for OSX clients. For those interested, the buggy classes of note are GWTDeploymentParticipant and LaunchUtils.
I posted a note on the contributor’s list and received a response from a Googler suggesting that I wrap my Java executable in a shell script. Not one to shy away from wrapping system executables with scripts, I decided to give it a shot tonight. My first shell script attempt was a disaster, so I gave it a whack in Python.
This is tested and somewhat guaranteed to work for JVM 1.6 under OSX:
cd /System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home/bin
sudo mv java java_wrapped
sudo nano java
And the script:
#!/usr/bin/env python
import sys
import os
print sys.argv
cmd = os.path.dirname(sys.argv[0]) + '/java_wrapped'
args = ['',
'-XX:CompileCommand=exclude,org/eclipse/core/internal/dtree/DataTreeNode,forwardDeltaWith',
'-XX:CompileCommand=exclude,org/eclipse/jdt/internal/compiler/lookup/ParameterizedTypeBinding,<init>',
'-XX:CompileCommand=exclude,org/eclipse/jdt/internal/compiler/lookup/ParameterizedMethodBinding,<init>']
args.extend(sys.argv[1:])
print cmd
print args
print ""
os.execv(cmd, args)
If you have any suggestions on how to improve my Python, I’d be glad to hear them in the comments.
UPDATE: Thanks to Vitali, I got a bash script working as well:
#!/bin/bash
`dirname $0`/java_wrapped \
"-XX:CompileCommand=exclude,org/eclipse/core/internal/dtree/DataTreeNode,forwardDeltaWith" \
"-XX:CompileCommand=exclude,org/eclipse/jdt/internal/compiler/lookup/ParameterizedTypeBinding,<init>" \
"-XX:CompileCommand=exclude,org/eclipse/jdt/internal/compiler/lookup/ParameterizedMethodBinding,<init>" \
"$@"
Read full post