The problem here is with the difference in the way command lines work on Windows (DOS) and Unix. Unix has traditionally had a command line interpreter (known as a "shell") which is clever enough to expand wildcards and regular expressions on its own. DOS, on the other hand, has a very dumb command line interpreter which passes exactly what is typed to the named program. This means that programs written for DOS and Unix make different assumptions about the arguments supplied to them.
If you type "java *.java" into a Unix shell, the shell expands the arguments and passes a command line of (for example) "java A.java B.java C.java" to the compiler. So the compiler just has to loop through the named files anc comopile them.
If you type "java *.java" into a DOS prompt, it does no processing and passes a command line of "java *.java" to the compiler. So the compiler has to search the current directory for files which match the
pattern.
This is all fine if you are actually using a command line interpreter, but if you use Runtime.exec(), you are not. Runtime.exec() invokes the program directly, bypassing the CLI.
On DOS, because programs have to process their own wildcards, this works. On Unix, because programs assume the shell has done it for them, it doesn't; there is no file "*.java"!
The work around is simple; On Unix, use a shell to expand the wildcards for you:
Runtime.exec("sh -c 'javac *.java');
For a really portable solution though, you will need to build up the full list of files yourself, and always call external programs with a list of real filenames, never wildcards.