Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set the output files when compiling with javac [duplicate]

Tags:

java

My previous question asked how to compile files with the command JAVAC. I still don't know how to set the output files of the compiled source files.

like image 245
zin Avatar asked Apr 17 '16 21:04

zin


People also ask

What is the output of javac?

The output of javac is always classfiles, and the name of the file matches the name of the class contained within it. (A source file with multiple classes in will result in multiple output files.)


1 Answers

The output of javac is always classfiles, and the name of the file matches the name of the class contained within it. (A source file with multiple classes in will result in multiple output files.)

If you use the -d command line option, javac will also use the package of the class to generate a directory hierarchy, with the -d option specifying the root. Otherwise, each class file will be output in the same directory as the source file from which it was compiled.

like image 131
Jon Skeet Avatar answered Sep 22 '22 21:09

Jon Skeet