To compile for the J2ME platform, you need some specific tool. Last time I had to do this (4 years ago, may have changed), I needed the SUN J2ME SDK (now: Sun Wireless toolkit : http://www.oracle.com/technetwork/java/index-jsp-137162.html - ).
This SDK (which contained a J2ME emulator) allowed to do some modification to the .class files generated, some pre-check that included additionnal information in the .class files (preverification). Without them, the code wouldn't run (I tried to do the same thing as you do, with a legacy application).
Here is a link in SO which a question (and answer) about this subject: What does preverification of J2ME application mean?