Eclipse - Setting .classpath file for existing project

风格不统一 提交于 2019-12-08 19:55:36

问题


I have a java project. The working folder from someone else's Eclipse project (It was a Repast Simphony project I think).

In my eclipse I created a new Java project and told it to use the existing code. So it seems to have brought in all the code.

However after loading the project I get this error:

Project 'My Project' is missing required Java project: 'Weka 3-7' 

It has a .classpath file with these contents:

<?xml version="1.0" encoding="UTF-8"?>
<classpath>
 <classpathentry kind="src" path="src"/>
 <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
 <classpathentry combineaccessrules="false" kind="src" path="/Weka-3-7"/>
 <classpathentry kind="output" path="bin"/>
</classpath>

What I've tried so far:

I installed Weka 3-7. Then I updated the .classpath file to say the following and reloaded the project.

<?xml version="1.0" encoding="UTF-8"?>
<classpath>
 <classpathentry kind="src" path="src"/>
 <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
 <classpathentry combineaccessrules="false" kind="src" path="C|/Program Files/Weka-3-7"/>
 <classpathentry kind="output" path="bin"/>
</classpath>

But now I get the error message:

Project 'My Project' is missing required source folder: 'C|/Program Files/Weka-3-7' 

Please help. I'm stuck.


回答1:


You want to use the context menu: My Project::(right mouse click)::Build Path::Configure Build path. This gives you the option to add/remove projects, Jars, source folders etc., what erver you need to provide those classes that your project references. You can get the same effect by hacking the .classpath manually, but you have to know very well what you're doing. Always use the frontend unless it absolutely can't do what you need.



来源:https://stackoverflow.com/questions/3343995/eclipse-setting-classpath-file-for-existing-project

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!