Java Eclipse 不记得源查找路径
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/493102/
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
Eclipse doesn't remember source lookup path
提问by serg
For some reason Eclipse doesn't remember source lookup path for some java projects, and every time during debugging (after redeploying) I need to press "Edit source lookup path" button and add current project to the list.
出于某种原因,Eclipse 不记得某些 Java 项目的源查找路径,并且每次在调试期间(重新部署后)我都需要按“编辑源查找路径”按钮并将当前项目添加到列表中。
Does anyone know how to make it remember selected source location?
有谁知道如何让它记住选定的源位置?
EDIT:It is a tomcat project, built with ant. Eclipse version is 3.2.2
编辑:这是一个 tomcat 项目,用 ant 构建。Eclipse 版本是 3.2.2
.classpath looks like this:
.classpath 看起来像这样:
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="web/WEB-INF/classes"/>
<classpathentry kind="lib" path="web/WEB-INF/lib/commons-collections-3.2.jar"/>
... bunch of libs here
</classpath>
UPDATE:I found required setting - it is under General Preferences -> Tomcat -> Source path.
更新:我找到了必需的设置 - 它位于 General Preferences -> Tomcat -> Source path 下。
采纳答案by Yoni
Try looking at the Run/Debug configuration for what you are executing, and check the source tab. You can add elements manually, but that is really not recommended.
尝试查看运行/调试配置以了解您正在执行的内容,并检查源选项卡。您可以手动添加元素,但确实不建议这样做。
The elements in the source tab are based on the classpath of the project containing the element that you run. In the case of running tomcat, the source path simply contains all the web projects that are associated with tomcat (and their dependencies).
源选项卡中的元素基于包含您运行的元素的项目的类路径。在运行 tomcat 的情况下,源路径只包含与 tomcat 关联的所有 web 项目(及其依赖项)。
回答by Vilmos Kiss
Solution is:
Window / Preferences
Tomcat / Source Path
解决方法是:
Window / Preferences
Tomcat / Source Path
Click your project name. Don't forget to change it if you cahnge to another project!
单击您的项目名称。如果您转换到另一个项目,请不要忘记更改它!
回答by Shashi
This can also be edited directly in the preferences file, which is in the location:
<workspace>\.metadata\.plugins\org.eclipse.debug.core\.launches\<debug configuration name>.launch
Example:
这也可以直接在首选项文件中进行编辑,该文件位于以下位置:
<workspace>\.metadata\.plugins\org.eclipse.debug.core\.launches\<debug configuration name>.launch
示例:
C:\Data\eclipse_ws\workspace\.metadata\.plugins\org.eclipse.debug.core\.launches\Tomcat.launch