如何更改 Eclipse 的“关联源”以进行调试?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/5097436/
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
How to change Eclipse's "associated source" for debugging?
提问by kc2001
I have a jar file that supplies some classes in my development environment. When I'm debugging in Eclipse, when I first step into a class supplied by that jar, Eclipse prompts me to give the location of the associated source files. I do so, and everything's fine.
我有一个 jar 文件,它在我的开发环境中提供了一些类。当我在 Eclipse 中调试时,当我第一次进入该 jar 提供的类时,Eclipse 会提示我提供相关源文件的位置。我这样做了,一切都很好。
Some time later, I replace the jar with a newer version. How can I instruct Eclipse to look in a different place for the newer source?
一段时间后,我用更新的版本替换了 jar。如何指示 Eclipse 在不同的地方寻找较新的源代码?
采纳答案by sleske
In the Project Explorer (or Navigator), find the JAR (should be listed under "library path"), right-click, properties, there you can delete the association to a source, and/or provide a new association.
在项目资源管理器(或导航器)中,找到 JAR(应列在“库路径”下),右键单击属性,您可以删除与源的关联,和/或提供新的关联。
Note: you must go to the properties for an individual JAR. You cannot get the equivalent dialog if you click on "JRE System Library"
注意:您必须转到单个 JAR 的属性。如果单击“JRE 系统库”,则无法获得等效对话框
回答by Graham P Heath
Right click on the Debugger panel, select Edit Source Lookup
右键单击调试器面板,选择 Edit Source Lookup
回答by Alain Pannetier
In the package explorer, where the jar is in a library (JRE, Maven dependencies, etc...); right click => properties => java source attachement.
在包资源管理器中,jar 位于库中(JRE、Maven 依赖项等...);右键单击 => 属性 => java 源附件。
Alternately in the project properties => Java build path => Library tab => select the jar => edit.
或者在项目属性 => Java 构建路径 => 库选项卡 => 选择 jar => 编辑。