Friday, April 17, 2009

javac from the command line

You are a Java developer and your platform of choice is Windows. I'll point you to a deeply nested directory with lots of source files in it and ask you to compile them. How do you do it?

If you immediately fire up your IDE, create a project, set it up with the source files and output directory and hit the Make button, then find out there is a quicker way to do it from the command line, an option many ignore:

cd the_directory_i_gave_you
dir /b /s *.java > source_files.txt
mkdir ..\out
javac -d ..\out @source_files.txt

No comments: