When trying to export a project as a .jar file, Eclipse will complain that some files can’t be found on the classpath:
Class files on classpath not found or not accessible for: ‘proj/src/main/java/analysis/specification/VerifyVariableIsDefinedInsideTargetTerm.java’
Now, the interesting part is that these files haven’t actually existed on the disk for ages. I guess I force Eclipse to refresh its database some way. I’ve tried doing F5 for a full build, but it seems to no avail. I’ve also tried the procedure described in this blog post, but the issue remains.
Error… I actually tripped on the reason for the problem a few moments ago…
All the files that were raising problems did actually exist on the project but were commented out (and thus, I didn’t see them in the package explorer which is the view I generally use).
After deleting them, everything went fine. I still don’t understand why would they raise errors in the JAR creation process, though…
EDIT:
Here’s an example of a commented out class:
Because the whole class is commented out, no
Example.classis created. Whereas if the class is commented out like this:an
Example.classis created, although empty.This may be a bug in eclipse. If you export the ant build script from eclipse and use that, it creates the JAR just fine.