Compiling java files in all subfolders? [duplicate]

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.

Leave a Comment