无法在 Eclipse 中设置断点
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/664851/
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
Can't set breakpoints in Eclipse
提问by mcccclean
Following the Android notepad tutorials using Eclipse 3.4.2 on OSX 10.5.6.
遵循在 OSX 10.5.6 上使用 Eclipse 3.4.2 的 Android 记事本教程。
I'm instructed to set a breakpoint in one of the following ways:
我被指示以下列方式之一设置断点:
Double click on the gray bar to the left of the editor pane.
- this just brings up the "Add Bookmark" window
Select "Toggle breakpoint" in the context menu
- the only options in the context menu are "Go to Annotation..." (which is disabled), "Add Bookmark", "Add Task", "Quick Diff", "Show line numbers", "Folding" and "Preferences"
双击编辑器窗格左侧的灰色栏。
- 这只是打开“添加书签”窗口
在上下文菜单中选择“切换断点”
- 上下文菜单中的唯一选项是“转到注释...”(已禁用)、“添加书签”、“添加任务”、“快速差异”、“显示行号”、“折叠”和“首选项”
My guess would be that the editor's in some mode that doesn't allow breakpoints to be set, but I'm only an Eclipse newb. Anyone able to lend any advice here?
我的猜测是编辑器处于某种不允许设置断点的模式,但我只是一个 Eclipse 新手。任何人都可以在这里提供任何建议?
采纳答案by Diones
When you double click the gray bar a blue ball appears? If it appears, try to hover you mouse over it and It may say "Line Breakpoint:Blablabla"
当您双击灰色条时,会出现一个蓝色球吗?如果出现,请尝试将鼠标悬停在它上面,它可能会显示“Line Breakpoint:Blablabla”
Otherwise, try to check if you are using a java editor to open your file. To check this right click the file you want to open, go to the Open With entry and check if Java Editor is selected, if there is not such option this means that you have not the JDT installed and is probably better to download the Java version of eclipse from its official website.
否则,请尝试检查您是否使用 Java 编辑器打开文件。要检查此项,请右键单击要打开的文件,转到“打开方式”条目并检查是否选择了 Java 编辑器,如果没有此选项,则表示您尚未安装 JDT,可能最好下载 Java 版本来自其官方网站的eclipse。
If none of the previous options helped, its probably a bug and you should report it to the eclipse bug systemif you would be so kind.
如果之前的选项都没有帮助,那么它可能是一个错误,如果您愿意的话,您应该将其报告给eclipse 错误系统。
回答by RgDev
- Right click on file(i.e. example.js)
- go to Open With
- click on Other
- click on Internal Editors radio button
- Select Java Editor from list
- 右键单击文件(即example.js)
- 去打开方式
- 点击其他
- 单击内部编辑器单选按钮
- 从列表中选择 Java 编辑器
Now you can set the break point by right click and selecting one from available methods i.e. toggle breakpoint / line/method etc.
现在您可以通过右键单击并从可用方法中选择一个来设置断点,即切换断点/行/方法等。
回答by mastDrinkNimbuPani
I had the exact same error. I re-started eclipse, but it didn't work. Then I closed all files, and re-opened the file of interest, yet it didn't work. Finally, I went into the Debug perspective, and tried setting the Break-point, and finally it worked for me.
我有完全相同的错误。我重新启动了eclipse,但是没有用。然后我关闭了所有文件,并重新打开了感兴趣的文件,但它不起作用。最后,我进入 Debug 透视图,并尝试设置 Break-point,最后它对我有用。
回答by neves
All my breakpoints had a diagonal line crossing it. I had this problem, but the reason was that one day before I've clicked in the "Skip all breakpoints" in the debug view. You must uncheck this option. You can access it in the "Run" menu.
我所有的断点都有一条对角线穿过它。我遇到了这个问题,但原因是前一天我在调试视图中单击了“跳过所有断点”。您必须取消选中此选项。您可以在“运行”菜单中访问它。
Maybe this answer will be useful for someone.
也许这个答案对某人有用。
回答by Laxman Jaygonde
This also happens when you try to place debug points in .jsp files. Eclipse won't allow you to debug .jsp files and that is why you are getting that add bookmark pop-up.
当您尝试在 .jsp 文件中放置调试点时,也会发生这种情况。Eclipse 不允许您调试 .jsp 文件,这就是您收到添加书签弹出窗口的原因。
Please check the type of file you are working on and place the breakpoints accordingly.
请检查您正在处理的文件类型并相应地放置断点。