This content has been marked as final. Show 5 replies
Thanks for your help.
I still don't understand something here though ... :/
The class files are put in corresponding directories. So when I compile
Bee, why compiler doesn't use class files provided (it can find it) and why
the source files need to be put in corresponding directories as well ?
Thanks for your patience !
So when I compileGood question.
Bee, why compiler doesn't use class files provided
In your OP you said that Bee.java compiles fine if the other two source files are deleted. What javac does is documented here http://java.sun.com/javase/6/docs/technotes/tools/windows/javac.html in the section "Searching For Types". My interpretation of that section is that the compiler would find the class files, but not the source files (because they are misplaced) and so would use the class files. But maybe that's wrong.
Anyway, I don't have that problem because I "arrange source files in a directory tree that reflects their package tree" as the documentation suggests.
I've read it. And in my case, everything should satisfy the compiler.
The source files and the class files are in the current directory
(class files in the corresponding subdirectories of the packages).
So when compiler wants to compiler Bee.java, it has in the current
directory both ./com/one/A.class and ./com/two/B.class classes
AND the source files if it needs to recompile it.
I also found this:
It doesn't seem to me logic :/