“This compilation unit is not on the build path of a java project” -Eclipse

时光总嘲笑我的痴心妄想 提交于 2019-12-23 19:30:13

问题


I am new to the eclipse environment. I clone my project from the repository(Hg) by New->Project->Mercurial->Clone existing project. Here my problem is "This compilation unit is not on the build path of a java project" message comes when I editing the coding. Auto completion not working. Kindly let me know how solve this problem...

Note: I searched in google as well as in stackoverflow. But still I am not clear in that.


回答1:


I had this problem in Eclipse on Windows 7 as well. The solution is Go to Project-> right Click-> Select Properties -> project Facets -> modify the java version for your JDK version you are using. Please note, if the JDK version of the project is higher, say, 1.5 and your project setting is jdk 1.4, then it will not work. Vice versa will work.




回答2:


Right click your project, select properties. On the left side select Java Build Path. Go to the Libraries tab and select the JRE System library. On the right side, click the edit option. Select the Alternate JRE radio button. See if the JDK you have installed is present in your drop down and select it. This should fix your problem.



来源:https://stackoverflow.com/questions/10731984/this-compilation-unit-is-not-on-the-build-path-of-a-java-project-eclipse

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