I have the following class structure:
Main Class: WordNet.java
WordNet.java uses SAP.java
SAP.java uses DeluxeBFS.java
When I run the command
$ javac WordNet.java
I get back
WordNet.class
WordNet$Synset.class
SAP.class
DeluxeBFS.class
DeluxeBFS$markDist.class
Synset and markDist are private classes.
What I don't understand though, is why if I make a change in DeluxeBFS, and recompile WordNet, that change is not compiled in. Since WordNet depends on DeluxeBFS, shouldn't the java compiler recompile it if a change is made? It seems like the file is not even touched.
No, the compiler finds the class file for DeluxeBFS
, and that's the end of it - it doesn't try to look for the source for it (which could be anywhere of course).
In general, it's a good idea to recompile everything when you're building from the command line with javac.
If you want incremental compilation which notices which files have been changed etc, you should use something an IDE like Eclipse.