eclipse magic: … Syntax error, varargs are only available if source level is 1.5 or greater

前端 未结 11 1435
醉话见心
醉话见心 2020-12-09 15:06

Yesterday I made a project in eclipse, and it was working, compiling. I used Eclipse Galileo for Java EE. Today I open eclipse and see lots of errors saying that stuff is no

相关标签:
11条回答
  • 2020-12-09 15:20

    Try this:

    Go to your project's Properties, set the Java Compiler compliance level to 1.6, let it rebuild the project, then switched back to 1.7 and rebuild it again.

    It worked for me :)

    0 讨论(0)
  • 2020-12-09 15:22

    Single answer couldn't solve my problem so I used both :

    • First right click on the error in problems tab
    • click Quick fix
    • ok
    • right click on the project
    • build path
    • configure build path
    • remove JRE library
    • add JRE library

    .... tada...done... :)

    0 讨论(0)
  • 2020-12-09 15:27

    Perhaps your project lacks in some necessary jars. Try this:

    • Right click your project>>build path>>select libraries>>add jars to add necessary jars in your project.
    • Go to your project's Properties, set the Java Compiler compliance level to 1.6 or above.
    • Go to your project's Properties,set the project facets. make the 'java' option to match your Java Compiler compliance level,such as '1.6'.
    0 讨论(0)
  • 2020-12-09 15:28
    1. Open Window | Preferences.
    2. Java | Compiler.
    3. Change compiler compliance level to some other value.
    4. Hit apply, allowing eclipse to build.
    5. Change compiler compliance level to desired level of Java.
    0 讨论(0)
  • 2020-12-09 15:30

    Just make sure Java > Installed JREs has jre6 instead of jdk1.6.0

    Eclipse seems detect jdk6 as not jre 1.5+

    0 讨论(0)
  • 2020-12-09 15:32

    See also: Eclipse: Syntax Error, parameterized types are only if source level is 1.5

    (I know, I know, this question is older by a year, but the other one contains some additional info in Jeff's answer.)

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