Search code examples
javacompilationjavac

How to ues javac to compile .java files wrote in a txt file?


I have some .java file, like a.java, b.java, c.java...., is there a way to compile them together by writting .java files' name into a txt file, and use some javac opitions to compile them? Like "javac (some options here) a.txt". The txt file contains the name of .java file that I want to compile.


Solution

  • Write java files paths separated by whitespace or newline to file.txt and call javac prepending file.txt with @

    javac @file.txt