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

前端 未结 11 1436
醉话见心
醉话见心 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:33

    I had the same issue after I installed Eclipse on Centos 7.

    However in my case changing the Compiler compliance level did not fix the problem.

    To fix the problem I changed the Eclipse Installed JREs Window->Preferences->Java->Installed JREs path, which was /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.242.b08-0.el7_7.x86_64 to an Oracle JDK at /usr/lib/jdk1.8.0_121-linux-x64

    After this change the problem went away.

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

    Check whether this works:

    1. Go to your project's Properties
    2. On the Properties dialog choose the Java Compiler node in the left tree.
    3. Finally set the Compiler compliance level to 1.5 or more.
    4. Rebuild the project.
    0 讨论(0)
  • 2020-12-09 15:39

    I had the same issue. For me, my project's compiler settings were imported from my Workspace Configuration settings, which was set to 1.8...

    I tried switching compiler levels and rebuilding, but no luck. What did the trick though, was the following:

    On your file system

    1. Navigate to your project.

    2. Delete the .settings folder.

    3. Delete the .project file

    In Eclipse:

    1. Delete the project from your workspace - Ensure that you do not check the "Delete project contents on disk..." checkbox

    2. Import your project and allow it to build

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

    and something interesting for GWT. even though i am using java 6, it throw me error saying source level should be 5 or later.

    Click the error, use the auto correct of eclipse, it change the compliance level to 5, solved the problem.

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

    If your JDK is already at or above 1.5 try changing your JDK compliance to something else, letting it build, and then back again.

    1. Open Preferences (Window -> Preferences)
    2. Navigate to Java -> Compiler
    3. Change the Compiler compliance level to some other value
    4. Hit Apply and allow eclipse to rebuild
    5. Repeat steps 3 & 4 with desired Compiler compliance level
    0 讨论(0)
提交回复
热议问题