如何阻止 Eclipse 3.4 在项目中丢失对 JRE 的引用
有时,当使用 eclipse 时,它会丢失对 JRE 的引用。
即它找不到像 Object 或 Arraylist 这样的类。
有些项目报告问题,而另一些项目则不报告问题,并且它们都使用相同的 JRE。
我发现,如果您将已安装的 JRE 切换到另一个,然后再切换回您想要使用的 JRE,它将再次工作
有没有更好的方法来阻止它这样做?
编辑:重新加载 Eclipse 并不能解决问题
Sometimes when using eclipse it loses references to the JRE.
i.e. It cannot find classes like Object or Arraylist.
Some projects report a problem while others don't and they both use the same JRE.
I have found that if you switch the installed JRE to another and then back again to the one you want to use, it will then work again
Is there a better way to stop it doing this?
EDIT: Reloading Eclipse doesn't solve the problem
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
就我个人而言,我将其归因于 Eclipse 中的错误。 检查并确保源 zip 已随 Eclipse 中的 JRE 安装一起安装。 我知道你的痛苦。 Eclipse 非常棒,但它仍然有一些小错误。
Personally, I would chalk this up to bugs in eclipse. Check and make sure the source zip is installed with your JRE installation in eclipse. I know your pain. Eclipse is fantastic, but it still has some minor bugs.
我也有过同样的经历。 仅在木卫三。 始终是同一个项目。 删除项目(当然不是源)并重新创建项目可以暂时修复它。 似乎快乐了一两周,然后又发生了。
I've had the same experience. Only in Ganymede. Always the same project. Deleting the project (but not the source of course) and re-creating the project fixes it temporarily. Seems to be happy for a week or two and then happens again.
启动 Eclipse 时运行 -clean 标志将从 Eclipse 中删除临时垃圾,并使 Eclipse 整体运行得更好。 我在这方面取得了不同程度的成功,并且它比重新创建项目或重新安装 eclipse 更容易实现。 试一试,看看会发生什么。
尽管这不适用于 3.4,但它仍然适用。
http://www.eclipsezone.com/eclipse/forums/t61566.html
Running the -clean flag when starting eclipse will remove temporary junk from the eclipse and make eclipse run better overall. I've had varying success with this, and it's a lot easier to implement than recreating the project or reinstalling eclipse. Give it a shot and see what happens.
Even though this is not for 3.4, it still applies.
http://www.eclipsezone.com/eclipse/forums/t61566.html
这发生在我身上,但在重新加载 Eclipse 后,一切都继续正常工作!
It happened to me, but after a reloading of Eclipse all continued working well!
我可能对此有一个解决方案。 Eclipse 几乎每天都会丢失我的许多 Java 项目中的 JRE 引用,并且重新启动或使用 -clean 启动并没有帮助。 我意识到这显然是某种类加载器问题,所以我所做的就是在编辑器中打开每个项目的“.classpath”文件,然后手动将 JRE 引用 classpathentry 行移动到文件中的第一个条目希望它能在任何其他可能影响其成功加载能力的类之前加载 JRE。
自从这样做之后,这个问题就没有再出现过。
我认为以“.”开头的文件 在默认 Eclipse 安装上,它们被包资源管理器中的过滤器隐藏,因此您可能需要禁用“.* Resources”过滤器才能打开“.classpath”文件。
I may have a resolution for this. Eclipse was losing the JRE references on many of my Java projects almost daily, and restarting or starting with -clean wasn't helping. I realised that it is clearly a classloader issue of some kind, so what I did was to open the ".classpath" file of each project in the editor and manually move the JRE reference classpathentry line to be the first entry in the file, in the hope that it would load the JRE before any other classes which might be affecting it's ability to load successfully.
Since doing this, the problem has not reoccurred.
I think the files starting with a "." are hidden by filter in the package explorer on a default eclipse install, so you may need to disable the ".* Resources" filter to be able to open the ".classpath" file.
项目中的 JRE 引用使用您在“已安装的 JRE”首选项页面中指定的名称进行存储。 更改名称就会破坏引用。 只需选择在切换 JRE 时可以重复使用的名称,或者选择工作区默认值作为项目的 JRE。
The JRE reference in your project is stored using the name you give it in the Installed JREs preference page. Change the name and you break the reference. Just pick names you can keep reusing when switching JREs, or select the workspace default as the JRE for the project.