The amazing adventures of Doug Hughes

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:

  1. The Eclipse Foundation specifies that an explicit JVM path is a Good Thing™
  2. On OSX, the JVM path is pretty much universal, since Apple considers the JVM to be part of the OS
  3. Having the Flex Builder 3 installer include the -vm argument in the .ini file is trivial.
  4. 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?

Comments on: "OSX 10.5 and FlexBuilder 3: You CAN have JVM Goodness(tm)" (5)

  1. Hey, really nice post.

    In order to get the Red5 Flash Server running, I needed the 1.6 JVM, unfortunately I realized too late that Flex doesn’t play well…

    I tried following your instructions, however Flex still dies on bootup.

    JVM terminated.

    Exit code=-1
    ….

    I even explicitly changed my Java version back to 1.5.0, by going to:

    /System/Library/Frameworks/JavaVM.framework/Versions

    and doing a ln -s 1.5.0 to both Current and CurrentJDK.

    Doing a java -version, I get:

    java version “1.5.0_16”
    Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_16-b06-284)
    Java HotSpot(TM) Client VM (build 1.5.0_16-133, mixed mode, sharing)

    So things look right, but not sure why Flex doesn’t pick up the change. Any ideas?

    Thank you very much!

    Like

  2. Dru Nelson said:

    This post saved me A LOT of time.

    Thanks!

    I ended up changing my java prefs back to 1.5 just so the install would work. Then I changed the prefs as you described and move my global java prefs back to 1.6.

    Like

  3. @Nick you have to put it on the newline like the example. It works like a charm if you do. Otherwise seems to ignore it.

    Like

  4. THANK YOU!!!

    The error in Flex is useless, and searching Adobe’s technotes/forums yields very little.

    Like

  5. this is great, thanks jared. just for google’s sake, i found this article after looking at this one:

    http://steve-brown.id.au/it-stuff/programming/eclipse-line-numbers-not-scrolling-on-osx.html

    oddly, my line numbers stopped scrolling tonight while working in Flex Builder 3.0.2. the above article told me it was likely an issue with eclipse using the 64-bit JVM instead of 32-bit, and this article showed me how to explicitly point FB at the 32-bit JVM (1.5).

    all better now.

    Like

Comments are closed.

Tag Cloud

<span>%d</span> bloggers like this: