I have installed Java SE Runtime Environment 8u192
https://www.oracle.com/technetwork/java/javase/downloads/jre8-downloads-2133155.html on Windows 10, and made some setting changes in Eclipse:
Window -> preferences -> java -> Installed JREs = jre1.8.0_192,
to make it use the new java.
When running this code:
package test;
public class LocalDateExample {
public static void main(String[] args) {
System.out.println(System.getProperty("java.version"));
}
}
I get the output:
1.8.0_192
If I edit the code to:
package test;
import java.time.LocalDate;
public class LocalDateExample {
public static void main(String[] args) {
System.out.println(System.getProperty("java.version"));
LocalDate localDate = LocalDate.now();
System.out.println(localDate);
}
}
I get this error:
LocalDate cannot be resolved to a type
Edit:
I believe that my problems comes from the fact, that Eclipse is missing Java 1.8 execution environment.
I can not just select it, as suggested here: How do I add execution environment 1.8 to Eclipse Luna? as it is missing completely.
What can I do to add or select the environment? I am using Eclipse
Helios Service Release 2 Build id: 20110301-1815 with no updates available.