An output directory must be specified when compiling a directory
When compiling a directory, you need to specify an output directory where the compiled files will be stored. This is necessary because the compiler needs a place to write the generated output files.
The output directory can be specified using a command line argument or in the build configuration file. It should be an existing directory or a directory that the compiler has permission to create.
For example, if you are using a command line compiler, you can specify the output directory using the -d or --output option followed by the directory path:
$ javac -d /path/to/output_directory /path/to/source_directory/*.java
If you are using a build tool like Apache Maven or Gradle, you can configure the output directory in the build configuration file (e.g., pom.xml for Maven or build.gradle for Gradle):
Maven:
<build>
<outputDirectory>/path/to/output_directory</outputDirectory>
</build>
Gradle:
sourceSets {
main {
output.dir("/path/to/output_directory")
}
}
By specifying the output directory, you ensure that the compiled files are generated and stored in a specific location, making it easier to manage and distribute the compiled code
原文地址: http://www.cveoy.top/t/topic/i1jn 著作权归作者所有。请勿转载和采集!