Compiling java files in all subfolders?

aneuryzm picture aneuryzm · Mar 4, 2011 · Viewed 56.7k times · Source

How to compile all java files in all subfolders on Unix, using javac?

Answer

Brandon Frohbieter picture Brandon Frohbieter · Mar 4, 2011

On Windows...

Create a batch file:

for /r %%a in (.) do (javac %%a\*.java)

...then execute it in the top-level source folder.

On Linux...

javac $(find ./rootdir/* | grep .java)

Both answers taken from this thread...

http://forums.oracle.com/forums/thread.jspa?threadID=1518437&tstart=15

But as others suggested, a build tool would probably prove helpful.