在Eclipse中使用jdk 1.6和jdk 1.7来为不同的项目

编程入门 行业动态 更新时间:2024-10-24 05:20:03
本文介绍了在Eclipse中使用jdk 1.6和jdk 1.7来为不同的项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 我正在使用Eclipse与JDK 1.7。我以前的项目是在java 7和JDK 1.7中开发的。 现在,我想在Eclipse中在JDK 1.6下构建一个新项目。有可能这样做,以便一些项目基于JDK 1.7,而其他项目基于JDK 1.6而没有冲突?

如果可以完成,请让我知道如何一步一步。

更新:我的默认JDK是1.7。我创建了一个基于jdk1.7的新项目。然后我去这个项目的属性,然后java编译器,然后更改合规设置,如下图所示。但是有一些错误发生。原因是什么原因导致此错误?

以下是问题视图

经过一番研究,我已经解决了这个问题。请参阅如何修复方面的参考版本。

解决方案

您可以将整体工作区属性设置为使用一个版本的Java并设置单个项目属性另一个。

  • 要设置整体工作区属性,请单击窗口> 首选项,然后导航到 Java >
  • 要设置项目属性,请右键单击项目,然后选择属性。导航到Java编译器并选中启用项目特定设置

您可以从已安装的JRE中进行选择为任一设置。要告诉Eclipse有关新安装的JRE,您可以打开工作区首选项并导航到 Java > 安装的JRE ,然后点击添加按钮。

I am using Eclipse with JDK 1.7. My previous projects are developed in java 7 and JDK 1.7. Now, I want to build a new project under JDK 1.6 in Eclipse. Is it possible to do that so that some projects are based on JDK 1.7 and some others are based on JDK 1.6 without conflicts?

If this can be done, please let me know how to do it step by step.

Update: My default JDK is 1.7. I created a new project that is based on jdk1.7 by default. And then I go to the property of this project, and then java compiler, then change the compliance settings as the image shows below. But there is some error occurred. What could be the reason causes this error?

The following is the "problem" view

After some research, I have solved this problem. please see the reference about how to fix the facet version.

解决方案

You can set overall workspace properties to use one version of Java and set individual project properties to use another.

  • To set overall workspace properties, click on Window > Preferences, then navigate to Java > Compiler.
  • To set project properties, right-click on the project and select Properties. Navigate to Java Compiler and check "Enable project specific settings"

You can choose from among the installed JREs for either setting. To tell Eclipse about a newly installed JRE, you can open the workspace preferences and navigate to Java > Installed JREs and then click the "Add" button.

更多推荐

在Eclipse中使用jdk 1.6和jdk 1.7来为不同的项目

本文发布于:2023-10-31 06:29:38,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1545294.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:来为   项目   jdk   Eclipse

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!