Search code examples
intellij-idea

IntelliJ: .class file outputs to src folder of submodule instead of project out folder when compiled via command line


I'm an IntelliJ noob.

I have a module with submodules, which contain submodules as well. When compiling class files from any submodule within IntelliJ, it outputs the .class file to the corresponding out folder of the parent module (as desired):

When compiled via "run" button in IntelliJ: When compiled via IntelliJ

However, when compiling the same file via the command line, the class files are generated within the src folder for that module:

.class file outputs to src folder of submodule instead of project out folder when compiled via command line. When compiled via command line

How can I get the java files compiled via command line to output to the same out folder as they do when compiled via intellij?

Thanks for any ideas.

I tried setting the dependencies of Lecture7... and LectureCode modules to DataStructures module and have the compiler output path to "inherit project compile output path" under module settings.


Solution

    1. Go to "File" -> "Project Structure" -> "Modules".
    2. Select your module.
    3. Select Paths.
    4. There you have the configure the output path for your source code and tests.