简体   繁体   English

在Eclipse中安装新的JRE之后,我所有的Java项目都出现错误

[英]All my java projects are giving errors after installing new JRE in Eclipse

I installed an older version of JRE all my projects start to give compiler errors . 我安装了旧版本的JRE,所有项目开始都会出现编译器错误。 (There is a cross and (Unbound) message onBuild Path for project) When I checked, they still see the uninstalled JRE in path. (项目的“构建路径”上有交叉和(未绑定)消息)当我检查时,他们仍然在路径中看到已卸载的JRE。 I did some of them and changed one by one but isn't there a quick way to add new JRE to all my current projects at one time? 我做了其中一些并逐个更改,但是没有一种快速的方法一次将新的JRE一次添加到我当前的所有项目中吗? I have almost 80 projects and to make them one by one is time consuming. 我有将近80个项目,要一个接一个地进行很费时间。

Thanks 谢谢

Right click on any projects->properties->java Build path-> 右键单击任何项​​目->属性-> Java构建路径->

      1)mark the JRE version in order and support 

      2)Add JRE system library in libraries.

Your projects are likely referring to their JRE using its name in the preferences. 您的项目可能会在首选项中使用其名称引用其JRE。 Go into your Installed JRE preference page and just make sure the new correct JRE that's actually there has the same "name" as the old one that's been uninstalled. 进入“已安装的JRE”首选项页面,只需确保实际存在的新正确JRE具有与已卸载的旧JRE相同的“名称”。 In the future, set your projects' JREs using the Execution Environment (Edit that entry from the Libraries tab). 将来,请使用执行环境(在“库”选项卡中编辑该条目)来设置项目的JRE。 项目的Java构建路径属性页面在此处输入图片说明

To fix all of your projects quickly, open the project .classpath files for a fixed project and the broken one, and use the Search menu to kick off a massive find/replace through all of your .classpath files. 要快速修复所有项目,请为固定项目和损坏的项目打开项目.classpath文件,然后使用“搜索”菜单对所有.classpath文件进行大规模查找/替换。

It would be done through correct usage of the IDE. 可以通过正确使用IDE来完成。 Your projects would have to be setup to use the workspace runtime, in which case setting a new default runtime in the workspace would swap it out in all projects. 必须将您的项目设置为使用工作空间运行时,在这种情况下,在工作空间中设置新的默认运行时会将其替换为所有项目。 But you may have to run an 'update project configuration' first, I'm not sure about that. 但是您可能必须首先运行“更新项目配置”,对此我不确定。

The alternative is to do what I do and that is to use Maven; 另一种方法是做我要做的事,那就是使用Maven。 then you control everything from your poms and not the Eclipse configuration, plus the settings even still apply when not using Eclipse. 然后您可以控制poms中的所有内容,而不是Eclipse配置,甚至在不使用Eclipse时这些设置仍然适用。 Its darned useful to be able to build binaries without having to boot up your IDE first, or integrate it all with little effort into a build server / continuous integration environment. 它之所以有用,是因为无需先启动IDE即可构建二进制文件,或者不费吹灰之力就将其全部集成到构建服务器/持续集成环境中。

May be this page should solve your problem. 可能此页面可以解决您的问题。

Help Eclipse Platform 帮助Eclipse平台

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM