How to treat each Java source file in the same project as a separate application?


I'm using IntelliJ for programming assignment. The teacher assigned the HW Problem Set with the following structure:


Homework Set

-- Problem Set 05







I would like to create a IntelliJ project for "Problem Set 05" and pull in all 5 Java source files. However, I need to work on each source file separately. The Java source files may have the same class method. Each problem builds on the earlier one. When I compile the project with IntelliJ it compiles all Java source files and complains about duplicate method name.

I would like to compile each Java source file as an independent Java class but be able to view all homework set as a single project.


Comment actions Permalink

Put them in different folders and make each folder a separate module with its own content and source root.

You can also use Compile action from the file context menu to build only one file and Run only one file by removing the Make step from the Before Launch section.


Please sign in to leave a comment.