在eclipse(sts)中更改为jdk 7
如何将项目从 JDK 6 切换到 7,我知道我没有使用它,因为 switch 不接受 String。
在构建路径中,我在编译器设置中有 jre 7 ,到处都有 1.7 ,但它仍然不起作用。我使用 Spring Tool Suite(基于 Eclipse)最新版本,它正式支持 Java 7。
在项目方面我也有 1.7。为什么它必须如此困难。
在 .ini 中,我有完全正确的 C:\Program Files\Java\jdk1.7.0\bin\javaw.exe -startup
我确信我的 IDE 支持 7,因为每当我创建新项目时,我都没有 String switch 语句的语法错误。
我的 JAVA HOME 设置为 JDK 1.7 :-)
更新:这个问题只发生在 Spring 性质的项目中。
更新 2:发生在 Spring MVC 项目模板中,Spring Hibernate 模板显然适用于 Java 7。
完全困惑。
How do I switch project from JDK 6 to 7, I know I am not using it because switch doesn't accept String.
In build path I have jre 7 in compiler settings I have 1.7 , everywhere and it still doesn't work. I use Spring Tool Suite(Eclipse based) latest version which officially supports Java 7.
And in project facets I also have 1.7. Why it has to be so bloody difficult.
And in .ini I have perfectly correct C:\Program Files\Java\jdk1.7.0\bin\javaw.exe
-startup
And I am sure my IDE supports 7 because whenever I create new project I have not syntax errors with String switch statement.
And my JAVA HOME set to JDK 1.7 :-)
UPDATE: The problem only happens with projects of Spring nature.
UPDATE 2: Happens with template Spring MVC project, Spring Hibernate template apparently works with Java 7.
Totally confused.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
当我在 Eclipse Indigo 中启动新的 Java 项目时,Eclipse 告诉我不支持编译器合规级别 1.7:
不可能从 Eclipse 内部更改这一点,属性对话框显示:
因此,作为结果,无法使用其中包含字符串的新 switch 语句:
请参阅 “Eclipse 论坛帖子” 了解有关该主题的更多信息。看来它只会在下一个 eclipse 版本中出现。
When I start a new Java project in Eclipse Indigo, eclipse tells me that the compiler compliance level 1.7 is not supported:
It is not possible to change that from inside eclipse, the properties dialog shows that:
So as a result, it is not possible to use the new switch statement with Strings in it:
See the "Eclipse Forums Post" for more information about the topic. It seems that it will come only with the next eclipse version.
在窗口/首选项/已安装的 JRE 中,您需要将 JDK1.7 设置为默认设置。此外,在“项目/属性 Java 编译器”中,还应该对其进行设置(或禁用项目特定设置)
更新:
在我的 .settings 文件夹中,有一个名为 org.eclipse.wst.common.project.facet 的文件.core.xml
并包含一些相当可疑的值。不确定这是否重要,但值得尝试关闭项目,更改它然后重新打开项目。如果这没有帮助,请在项目的所有文件中搜索字符串 1.6
In window / preferences / Installed JREs you need to have the JDK1.7 as the default set up. Additionally in Project / Properties Java Compiler it should be also set (or disable the project specific settings)
UPDATE :
In my .settings folder there is a file called org.eclipse.wst.common.project.facet.core.xml
and contains some rather suspicious values. Not sure it matters, but worth trying to close the project change it then reopen the project. If that doesnt help then search for the string 1.6 in all files in your project
比较简单 Java 项目和 Spring 项目之间的
.classpath
和.project
文件。有时,自然或其他项目设置可以进行不同的设置。Compare
.classpath
and.project
files between your simple Java projects and Spring projects. Sometimes the Nature or other project setting can be set differently.