Issue
What do I need in order to solve this problem? How to change JRE Library in Eclipse Project?
import java.util.Set;
import java.util.SortedSet;
import java.util.TreeSet;
import java.util.stream.Stream;
import java.util.stream.Collectors;
public class LabelGroup {
SortedSet<String> strSet1 = Stream.of("A", "B", "C", "D")
.collect(Collectors.toUnmodifiableSet());
}
Eclipse shows at Stream.of:
References to interface static methods are allowed only at source level 1.8 or above
Tried to install new software from official site as suggested by wiki.
Response:
Could not find (the software).
About Eclipse: Eclipse IDE for Enterprise Java Developers Version: 2018-12 (4.10.0) Build id: 20181214-0600
Project Settings: java build path: JRE System Library [JavaSE - 1.7]
Solution
You have JDK 7 installed instead of JDK 8. The Stream API appeared only in Java 8. You can download Java 8(JDK 8 or OpenJDK) from the official site and install it as a JDK in your project.
Click on the Add Library button. It brings your screen to point to the Java location.
Select Directory, button right besides JRE home and point to the installed folder location.
Answered By - Anton Sorokin