Wednesday, September 15, 2010

Java application launched from PPC or bad stub

If you see this in your OSX Console log after trying to launch a Java application, the problem is obvious - you've been given an application with a Java stub launcher that cannot be run on your version of OSX.

The solution is a little less obvious.

$cp /System/Library/Frameworks/JavaVM.framework/Resources/MacOS/JavaApplicationStub 
 /Applications/<APPNAME>.app/Contents/MacOS


Some nasty log messages from trying to log an install4j based app that suffered this problem

Notice 2010-09-15 11:29:16 PM [0x0-0x80080].com.install4j.5517-2803-0637-4585.7502[2585] [JavaAppLauncher Warning] Java application launched from PPC or bad stub. Relaunching in 32-bit, and tagging sub-processes to prefer 32-bit with $JAVA_ARCH=i386. 
Notice 2010-09-15 11:29:16 PM [0x0-0x80080].com.install4j.5517-2803-0637-4585.7502[2585] [JavaAppLauncher Warning] Java application launched from PPC or bad stub. Relaunching in 32-bit, and tagging sub-processes to prefer 32-bit with $JAVA_ARCH=i386. 
Notice 2010-09-15 11:29:16 PM [0x0-0x80080].com.install4j.5517-2803-0637-4585.7502[2585] [JavaAppLauncher Error] This process is [i386] and was re-exec'd from [i386], but for some reason we are trying re-exec to []. 
Notice 2010-09-15 11:29:16 PM [0x0-0x80080].com.install4j.5517-2803-0637-4585.7502[2585] [JavaAppLauncher Error] unable to find a version of Java to launch 
Notice 2010-09-15 11:29:16 PM [0x0-0x80080].com.install4j.5517-2803-0637-4585.7502[2585] [JavaAppLauncher Error] unable to find a version of Java to launch 
Warning 2010-09-15 11:29:16 PM com.apple.launchd[1556] ([0x0-0x80080].com.install4j.5517-2803-0637-4585.7502[2585]) Exited with exit code: 1