Cannot load 32-bit SWT libraries on 64-bit JVM

If you get this error running Flash Builder or Eclipse on OSX Snow Leopard, it’s because there’s a mismatch between the libraries bundled with the plugin involved and the JVM of the OS. To fix, do one of the following:

1. For Eclipse, go to Eclipse -> Preferences -> Java -> Installed JRE
2. For Flash Builder, go to Flash Builder -> Preferences -> Java -> Installed JREs

Then, edit the selected Java VM, adding the following value for the Default VM Arguments field
-d32

This just forces the JVM to default to the 32-bit version. Once that’s been done, that error message should be no more…

21 comments

  1. I am working on eclipse and unable to navigate to “settings”
    in the below path. Where is Eclipse in the menu? What version of eclipse are you using?

    Eclipse -> Settings -> Java -> Installed JRE

  2. I have found what you said and did exactly that but i got an error saying “Unrecognized Option: -d32”
    “could not create virtual machine”

  3. I have found what you said and i did exactly that but i get error dialogs box (could not create the Java virtual machine) and when i click on the OK button on the dialogs box in the Eclipse show this message

    Unrecognized option: -d32

    please i need help to fix this error.

  4. Sorry to hear about your troubles Ali. Would be glad to help. Can you share more info about your environment?

    FYI, I’m on OSX 10.6.4 and have tried this option w/Eclipse 3.5.2 and 3.6 and JVMs 1.5 and 1.6 and couldn’t reproduce.

    Do you still get the error after rebooting your system and launching Eclipse?

  5. Hi Ali, I encountered the same problem you had and fixed it. For your information, I’m running windows 7 64 bit. I actually have two jre installed on my system. One is located in program files/java the other is in program files(86)/java. The problem occur because I was using the 64 bit jre located in program files (note not 86). So I added a new jre to eclipse project from the program files(86)/java and used that jre to build and it works.

  6. For me, on OSX 10.5.8, the -d32 flag does absolutely nothing.

    If I select JRE 1.6 as the runtime environment, the -d32 flag is ignored (there’s no Java 32-bit available for mac for 1.6, afaik, so it has to ignore it and attempt to run in 64-bit mode), and I get this error.

    If I select JRE 1.5, it doesn’t matter whether I set the -d32 flag, as the default is 32-bit for the 1.5 JRE, at least on this version.

    So, for me, the solution was to switch to 1.5/Java 5 in the compiler compliance and 1.5 for the JRE.

  7. Dude, thank you so much! I was pulling my hair out trying the different VMs that come with Mac OSX (my ver: 10.6.6). This totally solved my issue.

  8. An update to Dazee’s comment above for Win 7 64bit. The actual folder name for the 32bit version is “Program Files (x86)” not “Program Files(86)” The space and the x are important.

  9. Excellent mate, it was a very direct clue to the problem. Also this -d32 can be added from “run configurations->arguments->VM arguments

  10. Thank you. The option seems not working for jre6 (“could not create the java virtual machine”) and not necessary for 32-bit JREs (works without the option).

    > Eclipse -> Preferences -> Java -> Installed JRE

    I have found my preferences in Debug/Run dialog.

Leave a Reply

Your email address will not be published. Required fields are marked *