Tag Archives: Syntax error

[Solved] Porject Error: Syntax error, annotations are only available if source level is 1.5 or greater

Because the project is SSH, the JDK version used is less than 1.8

Solution 1

Project upgrade to jdk1.7

Solution 2

Still use 1.8 to create an org.springframework.core package in the project, and create jdkversion. Java under the package

There is jdkversion.java under spring-core.jar

public static final int JAVA_18 = 5;

if(javaVersion.indexOf("1.8.") != -1{
  majorJavaVersion = 5;
}

[Solved] Syntax error, parameterized types are only available if source level is 1.5

Multiple markers at this line
– Syntax error, parameterized types are only available if source level is 1.5 or greater
– Incorrect number of arguments for type HashMap<K,V>; it cannot be parameterized with
arguments <>

Solution:

1,In eclipse menu Window—-preferences—-java—–compiler change the Compiler compliance level to 1.6 in the right
2,Right click the project, modify properties, find java compiler modify the compiler compliance level to 1.6