Compiling to a Different Directory

Contact Us or call 1-877-932-8228
Compiling to a Different Directory

Compiling to a Different Directory

You can supply a destination directory to the Java compiler, in order to keep your source and compiled files separate:

javac -d destination FileList

The destination directory can be a relative path from the current directory, or an absolute path. It must already exist, but any subdirectories necessary for package structures will be created.

Also, if you have existing compiled files in the source directories (like employees/Employee.class), then the compiler won't recompile those classes (and therefore they won't end up in the destination path) unless they are older than the associated .java file. You would need to "clean" the directories by deleting the .class files first.

Next