Java 如何防止 Eclipse 在启动时挂起?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/207843/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-11 11:22:44  来源:igfitidea点击:

How do I prevent Eclipse from hanging on startup?

javaeclipseeclipse-3.3

提问by Simon Nickerson

I am using Eclipse 3.3 ("Europa"). Periodically, Eclipse takes an inordinately long time (perhaps forever) to start up. The only thing I can see in the Eclipse log is:

我正在使用 Eclipse 3.3(“欧洲”)。Eclipse 周期性地需要非常长的时间(也许永远)来启动。我在 Eclipse 日志中唯一能看到的是:

    !ENTRY org.eclipse.core.resources 2 10035 2008-10-16 09:47:34.801
    !MESSAGE The workspace exited with unsaved changes in the previous session; refreshing workspace to recover changes.

Googling reveals someone's suggestionthat I remove the folder:

谷歌搜索显示有人建议我删除该文件夹:

workspace\.metadata\.plugins\org.eclipse.core.resources\.root\.indexes

This does not appear to have helped.

这似乎没有帮助。

Short of starting with a new workspace (something which I am not keen to do, as it takes me hours to set up all my projects again properly), is there a way to make Eclipse start up properly?

除了从新工作区开始(我不想做的事情,因为我需要花费数小时才能重新正确设置所有项目),有没有办法让 Eclipse 正确启动?

采纳答案by Jason

This may not be an exact solution for your issue, but in my case, I tracked the files that Eclipse was polling against with SysInternals Procmon, and found that Eclipse was constantly polling a fairly large snapshot file for one of my projects. Removed that, and everything started up fine (albeit with the workspace in the state it was at the previous launch).

这可能不是您问题的确切解决方案,但就我而言,我跟踪了 Eclipse 使用SysInternals Procmon轮询的文件,发现 Eclipse 不断为我的一个项目轮询相当大的快照文件。删除它,一切都正常启动(尽管工作区处于上次启动时的状态)。

The file removed was:

删除的文件是:

<workspace>\.metadata\.plugins\org.eclipse.core.resources\.projects\<project>\.markers.snap

回答by Ruben

You can try to start Eclipsefirst with the -cleanoption.

您可以尝试先从Eclipse-clean选项开始。

On Windows you can add the -cleanoption to your shortcut for eclipse. On Linuxyou can simply add it when starting Eclipsefrom the command line.

在 Windows 上,您可以将该-clean选项添加到 eclipse 的快捷方式中。在从命令行Linux启动时Eclipse,您可以简单地添加它。

回答by matt b

Windows -> Preferences -> General -> Startup and Shutdown

Windows -> Preferences -> General -> Startup and Shutdown

Is Refresh workspace on startupchecked?

Refresh workspace on startup选中?

回答by Jason

try:

尝试:

  1. cd to <workspace>\.metadata\.plugins\org.eclipse.core.resources
  2. remove the file *.snap(or .markersin Indigo)
  1. cd 到<workspace>\.metadata\.plugins\org.eclipse.core.resources
  2. 删除文件*.snap(或Indigo 中的.markers

回答by Jason

I just had problems with Eclipse starting up. It was fixed by deleting this file:

我刚刚在 Eclipse 启动时遇到了问题。通过删除此文件已修复:

rm org.eclipse.core.resources.prefs

rm org.eclipse.core.resources.prefs

I found in .settings

我在 .settings 中找到

回答by VHristov

Since I don't have a .snao or .prefs file in .metadata.plugins\org.eclipse.core.resourcesfolder (running on OS X), what did the trick for me was copy the .project folder to old.project, start Eclipse, and check

由于我在.metadata.plugins\org.eclipse.core.resources文件夹(在 OS X 上运行)中没有.snao 或 .prefs 文件,所以对我来说诀窍是将 .project 文件夹复制到 old.project ,启动 Eclipse,并检查

Windows -> Preferences -> General -> Startup and Shutdown -> Refresh workspace on startup

Windows -> 首选项 -> 常规 -> 启动和关机 -> 启动时刷新工作区

as proposed by matt b. After that, I closed Eclipse, renamed the folder old.projects back to .projects and after that everything worked fine again.

正如马特 b 所提议的那样。之后,我关闭了 Eclipse,将文件夹 old.projects 重命名回 .projects,之后一切又正常了。

回答by Isak Swahn

Check that the Workspace Launcher hasn't opened on your TV or some other second monitor. It happened to me. The symptoms look the same as the problem described.

检查 Workspace Launcher 是否未在您的电视或其他第二台显示器上打开。它发生在我身上。症状看起来与所描述的问题相同。

回答by Daniel

I had a similar problem with a rather large workspace in 3.5 and no .snap-files anywhere to be seen. "Windows-> Preferences-> General-> Startup and Shutdown -> Refresh workspace on startup" seems to be a workspace-related setting and so I couldn't change it for the workspace that was causing the hang.

我在 3.5 中有一个相当大的工作区时遇到了类似的问题,并且在任何地方都看不到 .snap 文件。“ Windows-> Preferences-> General-> 启动和关闭 -> 启动时刷新工作区”似乎是与工作区相关的设置,因此我无法为导致挂起的工作区更改它。

Running eclipsewith the command line parameter -refresh and then changing the setting seems to do the trick.

eclipse使用命令行参数 -refresh运行然后更改设置似乎可以解决问题。

回答by user555135

I also had luck with removing the *.snap files. Mine were located in a different directory than mentioned in the posts (below).

我也很幸运地删除了 *.snap 文件。我的所在目录与帖子(如下)中提到的目录不同。

<eclipse workspace>/.metadata/.plugins/org.eclipse.core.resources/.projects

Consequently, the following unix cmd did the trick:

因此,以下 unix cmd 成功了:

find <eclipse_workspace>/.metadata/.plugins/org.eclipse.core.resources/.projects  -name "*.snap" -exec rm -f {} \;

回答by User1

I did this:

我这样做了:

  1. cd to .metadata.plugins\org.eclipse.core.resources
  2. remove the file .snap
  3. Noticed the Progress tab was doing something every few seconds..it seemed stuck
  4. Exit eclipse (DO NOT FILE|RESTART HERE OR YOU HAVE TO GO BACK TO STEP 1 AGAIN)
  5. Open eclipse again.
  1. cd 到 .metadata.plugins\org.eclipse.core.resources
  2. 删除文件 .snap
  3. 注意到“进度”选项卡每隔几秒就会做一些事情……它似乎卡住了
  4. 退出 eclipse(不要在此处提交文件|重新启动,否则您必须再次返回第 1 步)
  5. 再次打开eclipse。

Using -refreshor -cleanwhen starting eclipse did not help.

使用-refresh-clean启动 eclipse 时没有帮助。