source folder is not on the java build class path, using JUnit

空扰寡人 提交于 2019-12-08 03:38:41

问题


I am new to web development and I've downloaded some demo projects to learn how to develop REST client side application using Eclipse.

These are two examples:

I am trying to write some test cases using JUnit for project 1, however, Right Click (a class) => new Junit Test Case => the error happens all the time telling me "source folder is not on the java build class path" and I can not create the JUnit file.

But for the project 2, all the info is filled automatically.

If I right click src for second project and in build path "remove from build path", it will become the same format (folders) as proj 1. But hundreds of errors of source code about package name, and all the "import" statements.

Is it related to how Eclipse works? Could anyone give a simple explanation of how I can change the proj 1 to the correct format? I tried to "build path" for proj 1 and... hundreds of error of the source code..

Thank you!


回答1:


In the project properties (right click on the project folder and select "Properties" from the menu) go to "Java Build Path" and add src as source folder.



来源:https://stackoverflow.com/questions/27794791/source-folder-is-not-on-the-java-build-class-path-using-junit

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