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

23,994

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.

Share:
23,994
Deepak Mani
Author by

Deepak Mani

Artist • Blogger • Nature lover • Photographer • Software Developer • Socialist • Wanderer

Updated on June 27, 2020

Comments

  • Deepak Mani
    Deepak Mani about 4 years

    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.

  • Deepak Mani
    Deepak Mani about 12 years
    Its working for normal java projects. The problem is in Hg cloned project only. Where the option java build path is not available as option. What I have to do now?