java构建工作区出现问题_Eclipse工作区项目突然有糟糕的构建路径(Eclipse workspace projects suddenly have bad build path)...

Eclipse工作区项目突然有糟糕的构建路径(Eclipse workspace projects suddenly have bad build path)

我去年春天创建了几个Java项目。 今天我打开Eclipse备份并选择了我在春天使用的工作区,但现在所有的项目都有一个红色的X. 他们都列出了同样的问题:

**The project was not built since its build path is incomplete. Cannot find the class file for java.lang.Object. Fix the build path then try building this project.**

构建路径看起来不错(我认为)。 我试图创建一个新项目作为实验,看它有差异。 新项目对话框有**Use default JRE (Currently jre7)**并在底部发出警告:

**The current workspace uses a 1.4 JRE with compiler compliance level 1.7. This is not recommendes and either the JRE or the compiler level should be changed.**

不确定自去年春天以来发生了什么变化,但显然有些事 我真的不明白它想告诉我什么。 ?任何人都有任何想法我会非常感激。 谢谢。

更新:我创建了一个新项目,并将其构建路径与去年春天的一个项目进行了比较。 在新项目中,它有: **JRE System Library [JRE7]**在现在有问题的旧项目中我看到: **JRE System Library [JAVASE-1.7](unbound)** 。

不知怎的,我认为“未绑定”意味着不好的事情。 仍然不明白去年春天的情况如何,现在突然间没有。

I generated several Java projects last spring. Today I opened Eclipse back up and selected the workspace I used in the spring but now all the projects have a red X on them. They all list the same problem:

**The project was not built since its build path is incomplete. Cannot find the class file for java.lang.Object. Fix the build path then try building this project.**

The build path looks ok (I think). I tried to create a new project as an experiment to see it there are differences. The new project dialog box has **Use default JRE (Currently jre7)** checked and a warning at the bottom:

**The current workspace uses a 1.4 JRE with compiler compliance level 1.7. This is not recommendes and either the JRE or the compiler level should be changed.**

Not sure what changed since last spring but something obviously has. I don't really understand what it is trying to tell me. ?Anybody have any ideas I would greatly appreciate it. Thanks.

Update: I created a new project and compared its buildpath to one of the projects from last spring. In the new project, it has: **JRE System Library [JRE7]** In the old project that now has the problem I see: **JRE System Library [JAVASE-1.7](unbound)**.

Somehow I think the "unbound" means something bad. Still do not understand how it was ok last spring and now suddenly it isn't.

原文:https://stackoverflow.com/questions/26915758

更新时间:2019-12-05 23:22

最满意答案

“未绑定”表示类路径中指定的路径中没有JRE。 我的猜测是,从去年春天开始,对你的java安装进行了修改。

要将项目绑定到JRE上,请单击“未绑定”JRE,然后单击“编辑...”按钮。 在Edit Library窗口中,选择一个正常工作的JRE(在您的情况下JRE 7可能是一个不错的选择),然后单击Finish。 “未绑定”消息应该消失,之后您的类路径应该没问题。

The "unbound" means that there is no JRE at the path specified in the classpath. My guess is that, since last spring, modifications were made to your java installation(s).

To bind your project back on a JRE, click on your "unbound" JRE and click on the "Edit..." button. In the Edit Library window, select a working JRE (JRE 7 would probably be a good choice in your case), then click on Finish. The "Unbound" message should disappear and your classpath should be okay afterwards.

2014-11-13

相关问答

您是否尝试从菜单中使用“项目”>“清除”? 这将迫使Eclipse中所选项目的新构建。 Have you tried using Project > Clean... from the menu? This will force a new build on the selected projects in Eclipse.

“未绑定”表示类路径中指定的路径中没有JRE。 我的猜测是,从去年春天开始,对你的java安装进行了修改。 要将项目绑定到JRE上,请单击“未绑定”JRE,然后单击“编辑...”按钮。 在Edit Library窗口中,选择一个正常工作的JRE(在您的情况下JRE 7可能是一个不错的选择),然后单击Finish。 “未绑定”消息应该消失,之后您的类路径应该没问题。 The "unbound" means that there is no JRE at the path specified in t

...

在“J2EE Module Dependencies”/“Web Libraries”下的项目属性中,在其中添加外部jar In your project properties under "J2EE Module Dependencies"/"Web Libraries" add your external jars there

鉴于你提到“Maven项目”,你是否正在使用像M2Eclipse这样的Maven eclipse插件? 假设您正在使用M2Eclipse,Maven依赖项库将自动为Maven项目启用。 对于普通的Java项目,导入库会强制您将项目配置为Maven项目(在项目的上下文菜单中,选择Configure - > Convert to Maven Project )。 话虽如此,当您导入Maven项目时,您会注意到“ 高级 ”选项(朝向“ 导入Maven项目 ”对话框的下半部分)。 当您展开此选项时,将有一

...

我个人使用的一个选项是用户库 。 首先,创建一个用户库,其中包含您要使用的所有Tomcat jar文件: Window > Preferences Java > Build Path > User Libraries 单击New... ,然后为其命名,例如Tomcat Library 选择它,然后单击Add External JARs... 找到Tomcat lib文件夹并多选一个要添加到类路径中的所有jar文件。 现在将用户库添加到您的项目类路径中: 在Package Explorer右键单击项

...

移动代码。 这是你唯一的选择。 您需要识别x中依赖于y的代码或依赖于x的y代码。 如果您可以将代码移动到其他项目,则可能会解决问题。 否则,您可能需要将代码移动到新项目。 我必须做两件事。 Move code. It's your only option. You need to identify code in x that depends on y or code in y that depends on x. If you can move the code to the other pro

...

如果你现在有一个有效的maven项目(也就是说你可以在MyEclipse之外构建它,使用外部maven安装)然后尝试剥离它的eclipse文件和设置(在MyEclipse之外),然后将它作为maven项目导入MyEclipse。 这应该将它全部设置为具有maven性质的MyEclipse项目。 看起来项目源文件夹(如“构建路径”属性页中所示)未正确设置。 另外,使用MyEclipse运行mvn eclipse:eclipse是不必要的,并且可能会导致问题。 希望通过导入maven项目来解决所有问题

...

我认为这是关于你的jre版本。 你试过jre6吗? 包浏览器>>右键单击>>构建补丁>>配置构建路径>>库>> 删除您的JRE。 然后添加库>> JRE系统库>>环境>>选择JRE6 >>完成 I think it is about your jre version. Did you try jre6 ? Package Explorer >> Right Click >> Build Patch >> Configure Build Path >> Libraries >> Delete You

...

在Chandrayya GK的回答背面,我找到了一个解决我的问题的简单解决方案,不涉及创建额外的项目等。 - 只需找到并替换类路径中jar的引用。 在eclipse中按Ctrl + H打开搜索窗口。 单击文件搜索选项卡 在“包含文本:”字段中,输入引用旧jar的classpathentry标记。 这可以在任何eclipse项目中的.classpath文件中找到。 我看起来像这样:

...

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值