为什么把eclipse的版本设置为1.7,还会报错,求大神帮忙

package java_grammar;

public class Example3_1 {
public static void main(String arg[]){
int []a={1,2,3,4,5,6,7,8};
for(int i:a){
System.out.println(i);

    }

}

}

for(int i:a){//不是for,是foreach
System.out.println(i);
}

    如果回答对您有帮助,请采纳

感觉是没有错的啊,贴出报错信息看看

完全拷贝到机器上试了没什么问题。如果有错最好把错误贴出来。

Set project compiler compliance settings to 1.5
Set project JRE build path entry to 'J2SE-1.5'
这是它的提示信息,但我把eclipse的版本设置到1.7,build path 中根本就没有J2SE-1.5这个选项,求大神们帮忙。

Exception in thread "main" java.lang.Error: Unresolved compilation problem:
Syntax error, 'for each' statements are only available if source level is 1.5 or greater

at java_grammar.Example3_1.main(Example3_1.java:6)
这是报错信息,如果for改为for each也是不对的,求解