one of the possible reason can be that your project does not have 'Java Builder'... to check it go to the
Project Preferences > Builders
here you see all builders of the project, do you have here 'Java Builder'
checked? if you don't, then in best case you can try to press 'New...' and choose it there; otherwise you can open .project
file and in block <buildSpec> .. </buildSpec>
add the following:
<buildSpec>
...
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
...
</buildSpec>
after Eclipse reloading you will see Java Builder and it should compile your classes.
But this is what typically happens to me ;) Otherwise check your builders, maybe take a look at 'Project Natures' in project preferences (obj.eclipse.jdt.core.javanature
should be at least checked).
Just hope it solves your issue