1
votes

Well I just started working on codenameone I have a quite decent experience with Java. My code is all good, got no problems although while compiling I get this: error: package java.time does not exist import java.time.LocalDate;

Yes I know LocalDate was introduced in Java8 so my netbeans is set on Java8 also my project. Note that I'm using Lambda Expresions and streams in the project without any problem.

What can cause this?

Update: This bug is not only with my machine, tested on several machines that run Java 8 correctly (java.time is seen) with JavaFX application or simple Java applications still have same bug with Codenameone projects.

3

3 Answers

2
votes

In NetBeans you need to choose Java8 in order to use Java8 features. It is not enough to only have Java8 installed.

1
votes

Finally I came to a fair answer. Codenameone is not compatible with all java 8 features. See here for more details.

0
votes

Find Java Dependencies -> JDK 1.8 (Default) -> rt.jar at your Projects frame in Netbeans. You should see java.time package under rt.jar. If not, there is something wrong with your Netbeans or JDK installation.

You can also check Tools -> Java Platform to make sure Java 8 is correctly configured with Netbeans.