Sunday, December 19, 2010

Error - 32-bit SWT on 64-bit JVM

This is more of a note to myself for the future and for anyone running into this issue.

Issue
When building an Eclipse RCP application on OSX, you may receive the following error.

java.lang.UnsatisfiedLinkError: Cannot load 32-bit SWT libraries on 64-bit JVM

Resolution
Tested on
  • Macbook Pro
  • OSX Snow Leopard 10.6.5
  • JVM 1.6.0_22
  • Eclipse Helios 3.6.1

1. Open the Run Configuration and switch to the Arguments tab
(Run -> Run Configurations -> RUN_CONFIG_NAME -> Arguments)

2. Add the string '-d32' (a space at the beginning and end, without the quotes) to the arguments text box at the end of the existing value.

3. That should do it. Apply and Run the app

Rationale
My understanding is that if you download the 32-bit Eclipse package like I did, it will load 32-bit SWT by default. However, OSX defaults to 64-bit. Providing the above property forces the JVM to run in a 32-bit mode.

Probably, if you download Eclipse 64-bit for OSX you may not run into this issue - I have not tried that as yet




No comments:

Int size on Apple Watch (watchOS)

  Even though Apple Watch chipset is 64-bits, Int is still 32-bit. To get 64 bit behavior you have to explicitly use Int64 https:// jeffver...