javacodenameoneeclipse-juno

Hello world application build fail (CodenameOne in Eclipse Juno)


Following the tutorial here.. https://www.codenameone.com/how-do-i---create-a-basic-hello-world-application--send-it-to-my-device-using-eclipse.html

I get a build fail because of the line:

b.addActionListener(e -> Dialog.show("Dialog Title", "Hi", "OK", null));

And why?

Compile shows:

java.lang.Error: Unresolved compilation problems: The operator > is undefined for the argument type(s) int, boolean Syntax error on token "-", -- expected


Solution

  • Java 8 not supported in most eclipse IDE compilers by default

    Works in Eclipse Kepler by downloading an Eclipse Java 8 Support library.

    Eclipse + Java 8 support?

    CodenameOne also works with the latest "Eclipse Neon" but there is a bug

    build.xml:147: Unable to find a javac compiler; com.sun.tools.javac.Main is not on the classpath. Perhaps JAVA_HOME does not point to the JDK. It is currently set to "C:\Program Files\Java\jre1.8.0_101"

    The solution I found for this was to ensure that the JRE 1.8 library is present under the libraries tab (project properties - Build Path - Libraries) and then hit "Apply" button, followed by "ok".