0

I was recently was trying to use a library that needed a 32-bit version of java. I tried to get my version of java to use the 32-bit version by using the flag -d32. However, I received the error:

Error: This Java instance does not support a 32-bit JVM. Please install the desired version.

I have been trying to find how to download the 32-bit version of java for OS X, but with little success. Any help would be welcome. Is it possible even without an official download to use OpenJDE in 32 bit form?

0

To my (limited) knowledge, OS X no longer receives 32-bit only versions of Java from Oracle, as the last version of OS X to support 32 bit machines was 10.6. With that said, the last Apple distribution of Java appears to support 32-bit mode–if you enable it. With that said, apparently it's still not always so happy about running. However, according to this post, by editing some binaries, you can force it to.

The key is to replace /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin/java with a 32-bit mode only binary.

  1. Use "xxd -g1 java | grep -E 'c. fa'" to find out the binary header.
xxd -g1 java | grep -E 'c. fa'
0001000: ce fa ed fe 07 00 00 00 03 00 00 00 02 00 00 00
000c4b0: 01 28 6f d8 ce 3b 3a b0 c9 cd fa 87 b1 35 df 08
000d000: cf fa ed fe 07 00 00 01 03 00 00 80 02 00 00 00
000f060: 00 0f 84 c7 fa ff ff 48 8d 3d 96 39 00 00 be 01

07 00 00 00 is the 32-bit one. 1

So the 32-bit binary starts from 0x1000 and ends at 0xd000 with a length of 0xc000.

  1. Extract the 32-bit mode binary using your favorite tools....(eg. dd) for me I like xxd as its syntax is easier to remember. Verify it by using "file java".

  2. Backup the original java binary.

  3. Replace the "/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin/java" binary with the extracted 32-bit mode only binary in step 2.

  4. Test! If Java console is not shown, and there is no Java preference to turn it on, you can use the deployment.properties file at ~/Library/Caches/Java and add "deployment.console.startup.mode=SHOW".

With that said, I don't the internals of Java well, and it's entirely possible that this changes based on which JVM you're using.

Not the answer you're looking for? Browse other questions tagged .