Sunday, February 28, 2010

Java ME on Arch Linux x64

I was trying to setup Java ME on my machine running 64-bit Arch. It wasn't a smooth process. This is a list of problems I encountered:

  1. The Java ME SDK 3.0 isn't available for Linux (yet). Had to settle for Sun Java Wireless Toolkit 2.5.2 for CLDC
  2. I have a 64-bit version of JDK installed on Arch. Java ME can't work with this. It throws a java.lang.UnsatisfiedLinkError: /opt/WTK2.5.2/bin/ /opt/WTK2.5.2/bin/ wrong ELF class: ELFCLASS32 (Possible cause: architecture word width mismatch)
  3. To fix this, I installed bin32-jre from the AUR
  4. Then edited the /opt/WTK2.5.2/bin/emulator file (path depending on where you've installed it), and changed the javapathtowtk to /opt/bin32-jre/jre/bin/
  5. Restarted NetBeans, tested a simple project and it worked!

(Note: The Java ME installer asks for a java path during installation. It may be possible to point it to bin32-java during this time)