-3

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

Conor
  • 327
  • 6
  • 15
  • 2
    Did you set your compiler to java8? – TMichelsen Jul 24 '16 at 13:34
  • I thought he same but in that case OP would just get 'error: illegal start of expression". Let's see what OP comes back with – raphaëλ Jul 24 '16 at 13:42
  • Seems to me that the JDK compliance level can only be set to 1.7 or less in Eclipse Juno. I've added the JRE 1.8 library and it still doesn't show up. – Conor Jul 24 '16 at 16:28

1 Answers1

1

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".

Conor
  • 327
  • 6
  • 15
  • You need Java 8 for Codename One and Eclipse needs to be installed on top of Java 8 which means you need to make sure it picked the right JDK in eclipse.ini. – Shai Almog Jul 25 '16 at 03:28