关于java 关键字enum不识别的解决办法
2024-08-31 02:07:26
从别人那儿拷贝过来的myeclipse java工程,打开一看标红了一大片,仔细一看,原来是不识别enum关键字,这就有点尴尬了。
我自己重新建了一个java工程,测试了下,假如我在新建工程的时候选择JavaSE-1.6:
是识别enum关键字的,但是假如我选择第二个或者默认的jdk1.8,那就不行了,后来发现java compiler compliance level中的最高上限也才1.7,所以,两种解决方法(原理是一样的),一是将compiler compliance level设置到1.5以上,另一个就是把.settings下的org.eclipse.jdt.core修改为以下内容:
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.6
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.6
应该就能解决问题了。
最新文章
- 根据浏览器显示界面大小变换,替换css文件方法
- SQLServer一次性删除重复的数据
- 词频统计web
- Linux rpm 查询
- Security configuration of SSH login entry - enterprise security practice
- 使用Android应用调用Web Service
- 18种CSS3loading效果完整版,兼容各大主流浏览器,提供在线小工具使用
- 5个让你的SaaS应用大卖的技巧
- jquery选择器中两个class是什么意思?
- 每天一个linux命令(1):which命令(转)
- MATLAB图像处理基础
- IOS 类似于网易新闻首页新闻轮播的组件
- 扩展jquery插件的方法
- dubbo结构及通信简介
- .NET性能优化小技巧
- LeetCode 160 相交链表
- windows短路径转换成长路径
- 王者荣耀交流协会第5次Scrum立会
- 最新Android &; iOS设计尺寸规范
- Sift中尺度空间、高斯金字塔、差分金字塔(DOG金字塔)、图像金字塔