Why are you trying to compile the classes individually?
Use a build system like maven or ant or just let your IDE do it.
The only safe thing to do is to recompile every java which depends of a java class which has changed until every class which could be effected has been re-compiled.