Last updated

JInput Mac OS X 64 bit natives

Yesterday I ran into a little problem running Slick 2D on Java 6 64bit on my Mac. It’s a MacPro, which has a 64 bit processor and is running Leopard. The problem I encountered was related to the native libraries provided by LWJGL.

If you’re a user of LWJGL, you’ll be using JInput as well. Unfortunately, JInput does not currently have any 64 bit native libraries as it is only providing for PPC and i386 (32bit). This is a problem because Mac OS X users are somewhat bound to Java 6 64bit. There is no 32 bit version of Java 6 for Mac OS X.

1
2$ file libjinput-osx.jnilib
3libjinput-osx.jnilib: Mach-O universal binary with 2 architectures
4libjinput-osx.jnilib (for architecture ppc):	Mach-O dynamically linked shared library ppc
5libjinput-osx.jnilib (for architecture i386):	Mach-O dynamically linked shared library i386

Thus, the default JInput natives provided by LWJGL, and subsequently by projects like Slick 2D and jME are of no use on a system running Java 6 64 bit. Also games and other apps based on those libraries won’t run on Java 6 64 bit!

To solve this, I recompiled the JInput natives from CVS with 64 bit support:

1
2$ file libjinput-osx.jnilib
3libjinput-osx.jnilib: Mach-O universal binary with 3 architectures
4libjinput-osx.jnilib (for architecture ppc):	Mach-O dynamically linked shared library ppc
5libjinput-osx.jnilib (for architecture i386):	Mach-O dynamically linked shared library i386
6libjinput-osx.jnilib (for architecture x86_64):	Mach-O 64-bit dynamically linked shared library x86_64

I packaged the Mac OS X native (libjinput-osx.jnilib) and the resulting jinput.jar and jinput-test.jar up and you can download them here:

jinput-20090901-osx+ppc+i386+x86_64.tar

Note: I’m not running Linux or Windows at the moment, so I can’t provide any recompiled binaries for those platforms.

Question: now, how do I package this up nicely so I can use it in my Slice 2D based app?