2

I'm trying to work on a small project in Java version 8. I installed IntelIJ IDEA, but unfortunately I can't get it to compile java 8 code, such as:

import java.util.function.*;

I followed this tutorial, and downloaded and installed JRE 1.8, resulting in my About window looking like this:

JRE 1.8.0_152

However, it still does not see the java.util.function package, and if I run the following code:

public class Main {
    public static void main(String[] args) {
        System.out.println(System.getProperty("java.version"));
    }
}

it outputs 1.6.0_65.

I would appreciate some insight

Jytug
  • 1,072
  • 2
  • 11
  • 29
  • 1
    https://stackoverflow.com/questions/18987228/how-do-i-change-the-intellij-idea-default-jdk – Bedla Nov 25 '17 at 21:06
  • please, go to the project structure and show us screen. Also, type in your console `echo $JAVA_HOME` and show us output – Artur Czopek Nov 25 '17 at 21:31
  • @ArturCzopek your suggestion was really the key to my problem - it turned out that I didn't have JDK 1.8 installed and the project SDK was set to 1.6. Now it works perfectly – Jytug Nov 25 '17 at 21:34

0 Answers0