OSX 10.5 and FlexBuilder 3: You CAN have JVM Goodness(tm)
Over the course of the last 48 hours I’ve been trying to nail down the last few issues in moving to OSX 10.5 64-bit. I’ve run into ColdFusion/Apache 2.2 configuration issues (that’s a whole other blog post), I’ve run into issues that one always runs into when changing systems, and I ran into one file, and potentially excruciating issue that I want to address here. That issue is (in my opinion incorrectly) addressed in Adobe technote kb405284 titled "Flex Builder 3.x not supported with 64 bit Java 1.6 on Mac OS X" wherein Adobe asserts that the only solution to running FlexBuilder 3 on OSX is to revert the JVM to the 32-bit Java 1.5.0 that comes with the computer. This posed a serious dilemma.
I had just spent 12 hours getting around install issues, connector config issues, migration issues, and the rest of the issues that you encounter with a major change, and I wasn’t about to sacrifice my ability to run 64-bit ColdFusion for the sake of FlexBuilder 3. So I started experimenting… shell scripts are marvelous things that I’ve been playing with a lot lately and I tried swapping VMs around before launching apps, I tried launching applications with explicit paths to the JVM I wanted it to use, I tried all kinds of things. Then, in a brief IM conversation with my friend Simeon Bateman, he reminded me that launch-time directives go in the .ini file included with the install.
So I ran off to do a bit more Googling, which led me to this post in the Eclipse wiki, dealing specifically with Eclipse.ini. On OSX, it’s located at /Applications/Adobe Flex Builder3/Flex Builder.app/Contents/MacOS/FlexBuilder.ini, and it’s sooooo easy to specify the VM you want to use:
-vm /System/Library/Frameworks/JavaVM.framework/Versions/1.5.0 -vmargs -Xdock:icon=../Resources/flexbuilder.icns -Xdock:name=Flex Builder -XstartOnFirstThread -Xms128m -Xmx512m -XX:MaxPermSize=256m -XX:PermSize=64m -Dorg.eclipse.swt.internal.carbon.smallFonts -Dorg.eclipse.swt.internal.carbon.noFocusRing
Those first 2 lines: “-vm /path/to/your/vm/1.x.x” Yeah, that’s it.
The only gotcha is that they have to be on separate lines in the .ini file and they have to appear before the -vmargs directive because everything after that is passed as VM arguments when Java is being launched.
If you’re running Eclipse proper, the same concept applies only it should be at /Applications/eclipse/Eclipse.app/Contents/MacOS/eclipse.ini, or you can launch Eclipse using the symlink located at /Appplications/eclipse/eclipse and pass the -vm argument directly in (but why on earth would you want to do that?)
The reason I say that the above-mentioned Adobe KB article is incorrect is for a couple of reasons:
- The Eclipse Foundation specifies that an explicit JVM path is a Good Thing™
- On OSX, the JVM path is pretty much universal, since Apple considers the JVM to be part of the OS
- Having the Flex Builder 3 installer include the -vm argument in the .ini file is trivial.
- Since Apple only releases major versions of Java with a new OS, chances are that the highest-rev JVM on a Mac is not going to change, and if it does, well, there are other ways to deal with that issue.
So I don’t really understand why Adobe would insist that we run an older JVM just to get Flex Builder running when there’s such an excellent alternative. Right now I’m running CF8 on Java 1.6 64-bit and Flex Builder 3 on 32-bit Java 1.5.0 and everything is co-existing happily. Give it a try and let me know how it works for you?