Problem: Eclipse Showing error message - "This compilation unit is not on the build path of a Java project"
If you import a project as a General Project, it wont have the java nature and that will be a problem. In my case this was true . And rectifying the same will be as follows,