Ideally you would use a build system such as Maven, ANT, etc
If you are just compiling classes which are in the current working directory, and you have not used packages, you can quite happily use
$ javac *.java
If you have used some packages (and have put the files in their correct package directories) you can use
$ javac $(find . -name \*.java)
When you get to a large number of files, you will need to list them in a file and reference that via a @ argument, eg
$ find . -name \*.java > ./java-files.txt
$ javac @./java-files.txt
But ultimately a build tool will make life a lot easier.
mavenThis will allows you do build complex and download libraries as required.