This compilation unit is not on the build path of a Java project
Since you imported the project as a General Project, it does not have the java nature and that is the problem.
Add the below lines in the .project file of your workspace and refresh.
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
Another alternative to Loganathan Mohanraj's solution (which effectively does the same, but from the GUI):
- Right-Click on your project
- Go to "Properties"
- Choose "Project Natures"
- Click on "Add"
- Choose "Java"
- Click "Apply and Close"
If it is a Maven project then sometimes re-importing of it helps:
- Right-click the project in the Project Explorer and choose Delete.
- File > Import... > Maven > Existing Maven Projects > Next > Root Directory > Browse your project from Disk.
Hope it will resolve the issue.