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

Viewed 97786

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 not available and that it is only available if source level is 1.5.

What to do?

11 Answers

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 :)

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

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.

Related