openjdk 1.7 in eclipse: operator is not allowed for source level below 1.7

后端 未结 8 1226
无人共我
无人共我 2020-12-14 14:17

Eclipse gives me an error:

\'<>\' operator is not allowed for source level below 1.7 

I guess this is because it is not using java 1

相关标签:
8条回答
  • 2020-12-14 14:34

    I had the same problem, but with the - Compiler Compliance Level - Generated .class files compatibility - Source compatibility all already set to 1.7. I reselected 1.7 on all 3 and then Eclipse detected it, asked to rebuild and built my project successfully.

    0 讨论(0)
  • 2020-12-14 14:35

    Window->Preferences->Java->Compiler

    select 1.7 and hit okay.

    If you are building automatically, it will require a full re-build.

    0 讨论(0)
  • 2020-12-14 14:37

    right click on the error, choose quick fix, and select change JRE to 1.7

    0 讨论(0)
  • 2020-12-14 14:44

    right click on Project - properties - Java Complier - Compiler compliance -set level 1.7

    0 讨论(0)
  • 2020-12-14 14:48

    If you would like to stick with java 1.6, Search and replace <> with empty string. You'll get compiler warnings but the errors should go away.

    0 讨论(0)
  • 2020-12-14 14:49

    In your project's preferences, you must set the compiler --source option to 1.7 and --target option to 1.7 also. There are dedicated option boxes for that.

    Right-click on the project. Choose Properties. Choose Java Compiler on the left. Choose 1.7 for the Compiler Compliance level. If the 2 drop-downs below that aren't 1.7, uncheck Use default compliance settings and set those to 1.7.

    0 讨论(0)
提交回复
热议问题