eclipse編譯Syntax error, parameterized types are only available if source level is 5.0

在myeclipse裏引入新項目的時候會報如下錯誤:

在使用泛型的地方提示:

Multiple markers at this line
- Syntax error, parameterized types are only available if source level is 5.0
- The type List is not generic; it cannot be parameterized with arguments <Application>

1)一種是Eclipse對所有項目默認的設置是5.0以下,項目繼承了默認設置(在Preferences/Java/Compiler裏改爲5.0或高於5.0)
另一種是項目裏設置了source level 5.0以下(在 項目屬性/Java Compiler 裏改爲5.0或高於5.0)

 

你的JDK 版本比較舊,或者你裝了比較新的版本,但是你在Eclipse中的設置有問題,編譯級別設置的不是比較新的版本的編譯器。
eclipse措無題詩如下:
Multiple markers at this line
- Syntax error, parameterized types are only available if source level is 5.0
譯:語法錯誤 ,泛型只有在5.0以上的版本才支持
- The type List is not generic; it cannot be parameterized with arguments <Application>
List 不是泛型,引起的原因還是編譯器不支持~~

解決辦法: 在Eclipse中,菜單條 ---"Windows" ----"preferneces"
在彈出對話框中 ,在左側列表框中 選擇 "JAVA" ---子菜單中 "compiler" ...
然後在右側把 "Compiler compliance level" 設置成5.0以上 即可。

下午做東西時,遇到這個問題,問題果然如此。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章