`
aben328
  • 浏览: 1460600 次
  • 性别: Icon_minigender_1
  • 来自: 广东
社区版块
存档分类

Syntax error, type parameters are only available if source level is 1.5

阅读更多

当我的eclipse使用jdk1.6的时候,创建泛型类,系统会提示错误:

“Set project compiler compliance settings to '1.5'”

“Syntax error, type parameters are only available if source level is 1.5”

这时候需要改动两个地方:

1.右击项目-->properties-->java compiler -->选择enabel project specific setting -->Compiler compliance level :选择1.5版本,其他默认

2.右击项目-->properties -->project facets-->将java后的下拉框选择为5.0

 

 

 

eclipse编译Syntax error, parameterized types are only available if source level is 5.0

java 2009-09-29 15:16:50 阅读313 评论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以上 即可。

分享到:
评论

相关推荐

    2009 达内Unix学习笔记

    集合了 所有的 Unix命令大全 ...telnet 192.168.0.23 自己帐号 sd08077-you0 ftp工具 192.168.0.202 tools-toolss ... 各个 shell 可互相切换 ksh:$ sh:$ csh:guangzhou% bash:bash-3.00$ ... 命令和参数之间必需用空格隔...

    Google C++ Style Guide(Google C++编程规范)高清PDF

    It is important to know that functions are not always inlined even if they are declared as such; for example, virtual and recursive functions are not normally inlined. Usually recursive functions ...

    IOS5 Programming Cookbook

    - **If Statement Syntax**: The `if` statement is used to execute code based on a condition. The basic syntax is `if (condition) { /* code */ }`. - **Comparison Operators**: Comparison operators are ...

    Delphi7.1 Update

    * The Delphi 7 documentation PDF files are available on the update CD.========================================================UPDATING LOCALIZED VERSIONS OF DELPHI 7* This update can be applied only ...

    acpi控制笔记本风扇转速

    is larger than the largest known FADT version, and 2) if there is a mismatch between a 32-bit block address and the 64-bit X counterpart (when both are non-zero.) Example Code and Data Size: These ...

    php.ini-development

    The syntax of the file is extremely simple. Whitespace and lines ; beginning with a semicolon are silently ignored (as you probably guessed). ; Section headers (e.g. [Foo]) are also silently ignored,...

    C# Game Programming Cookbook for Unity 3D - 2014

    Acknowledgments xiii Introduction xv 1. Making Games the Modular Way 1 1.1 Important Programming Concepts.....................................2 1.1.1 Manager and Controller Scripts.......................

    WPTools.v6.29.1.Pro

    This is only useful if ObjRef = nil and so no ObjRef.Filename can be set. + TParagraph.GetSubText now has optional parameter to disable the object reference char codes #1, #2 and #3 * ...

    python3.6.5参考手册 chm

    PEP 446: Newly Created File Descriptors Are Non-Inheritable Improvements to Codec Handling PEP 451: A ModuleSpec Type for the Import System Other Language Changes New Modules asyncio ensurepip ...

    The Art of Assembly Language Programming

    You are visitor as of October 17, 1996. The Art of Assembly Language Programming &lt;br&gt;Forward Why Would Anyone Learn This Stuff? 1 What's Wrong With Assembly Language 2 What's Right With ...

    Sql for mysql

    1.8 What Is Open Source Software?. . . . . . . . . . . . . . . . . . . . . . . . 25 1.9 The History of MySQL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 1.10 The Structure of This...

Global site tag (gtag.js) - Google Analytics