Wireless toolkit emulator in netbeans not working on Ubuntu Natty (64bit)

I recently installed netbeans, and even though my midlet (Hello world default) built and compiled successfully, for the life of me I couldnt get it to run on the wireless toolkit emulator! And heres what i found, the WTK only runs on 32 bit systems which is a bummer, but all is not lost 🙂 With a bit of tweaking you can get it to run on 64 bit Ubuntu -> the key lies in using the 32 bit JDK. Follow these steps exactly to get your netbeans WTK emulator to work like a charm:

Step 1 -> Download the 32 bit JDK here

Step 2 -> Download the WTK 2.5.2 here — scroll down to find the download button

Step 3 -> install the 32bit JDK in your home directory by doing the following: sh jdk-6u26-linux-i586.bin and following the instructions. If for some reason it installs to your desktop, just cut and paste it in your home directory. Some people may have an error about install.sfx or something similar about a file not being found -> solution -> sudo apt-get install g++-multilib

Step 4 -> install the WTK by doing the following: sh sun_java_wireless_toolkit-2.5.2_01-linuxi486.bin.sh and when it asks for the JDK directory, be sure to point it to the recently installed 32 bit JDK. It expects the bin directory, so you would pass it the following path (be sure to replace USER with your username): /home/USER/jdk1.6.0_26/bin

Step 5 -> Once the JDK and WTK are installed you need to open netbeans -> click on tools -> java platforms -> add platform -> select JavaME MIDP platform emulator -> point to your WTK folder which is in your home directory

Step 6 -> Remove any existing WTK platform emulators (DO NOT REMOVE JAVA PLATFORM FOR HEAVEN SAKE)

If the build fails in netbeans install the following: sudo apt-get install ia32-libs