javac TestProgram1.java TestProgram2.java TestProgram3.java
You can use a wildcard to compile all the files in a folder, for example:
javac *.java
If you need to compile a large number of files at the same time, but do not want to use a wildcard (perhaps you want to compile a large number of files, but not all the files in a folder), you can create an argument file that lists the files to compile. In the arguments file, you can enter as many file names as you want, using spaces or line breaks to separate them. Heres an argument file called TestPrograms, which lists three files to compile:
TestProgram1.java TestProgram2.java TestProgram3.java
You can compile all the programs in this file with the @ symbol, followed by the name of the argument file on the javac command line, for example:
javac @TestPrograms
-cp and -classpath
Determines where to look for user class files. Use this option if your program uses class files that you saved in a separate folder.
source share