Search code examples
javacompilationjavacdirectory-structure

Java: How can I compile an entire directory structure of code ?


The use case is simple. I got the source files that were created using Eclipse. So, there is a deep directory structure, where any Java class could be referring to another Java class in the same, child, sibling or parent folder.

How do I compile this whole thing from the terminal using javac ?


Solution

  • You have to know all the directories, or be able to use wildcard ..

    javac dir1/*.java dir2/*.java dir3/dir4/*.java dir3/dir5/*.java dir6/*src/*.java