The “import java.util.function cannot be resolved” error

后端 未结 8 1514
感动是毒
感动是毒 2021-01-11 12:49

I\'m trying to run this practice script from the standard Oracle Java tutorials.

This seems to be a common error and I\'ve used SO resources to make attempts to fix

相关标签:
8条回答
  • 2021-01-11 13:36

    I ran into this while trying to use Java 9 with Eclipse Oxygen. Eclipse claimed that I was using less than Java 1.8 and asked if I wanted to use 1.8. Saying yes solved the problem, but led to this error message later on.

    I went in to Window => Preferences => Java => Compiler and saw that this had been changed to 1.8, so I changed it back to 9 and everything seems to be working now.

    0 讨论(0)
  • 2021-01-11 13:38

    Ran into this problem when the version I was using in the below properties was <1.8. Updating my POM to a version >1.8 resolved my issue.

    <properties>
         <maven.compiler.source>1.9</maven.compiler.source>
         <maven.compiler.target>1.9</maven.compiler.target>
    </properties>
    
    0 讨论(0)
提交回复
热议问题