Solved: Cannot compile J2ME project

Hi

in my case, I was not able to compile LWUIT (http://lwuit.java.net/) with IntelliJ. It took me a long time to figure out, what was going wrong and it is not intuitive at all, how to convince IntelliJ to compile this J2ME library correctly. So, I decided to share my knowledge.

Problem: Compiler stops with error message "cannot find symbol method". In my case this was:

/.../IdeaProjects/LWUIT/src/com/sun/lwuit/EncodedImage.java
-> cannot find symbol method initCause(java.lang.ClassNotFoundException)

How to solve it: Though you define "1.3" as project language level in your project settings, this is not enough. You additionally have to put this line into the "Additional command line parameters" field of the Java compiler settings (Settings/Project Settings/Compiler/Java Compiler/Additional command line parameters):

-source 1.3 -target 1.1

I think this is nearly a bug, because as far as I know, J2ME is restricted to Java 1.1. Am I wrong?

Regards
Christoph

Please sign in to leave a comment.