How to run a single java file. Follow
Answered
I'm working on a project which has many modules. Whenever I try to run a single file, it either builds/compile the whole project or build/compile the whole module.
In the image, you can see I have a file named "Dynamic.java". Whenever I try to run it, it builds the whole module "Chapter 08". I just want to run "Dynamic.java" but the compiler doesn't let me do so. It says "duplicate classes".
It is an obvious thing that "Inheritcance.java" and "Dynamic.java" has the same class name. But they aren't dependent on one another they have their own main. So I want to run them independently irrespective of how another file is written or whatever it has. Is it possible to do so?
Please sign in to leave a comment.
Hello,
You may remove "Build" action from "Before launch" section of run configuration.
I did as you said but sadly it didn't work and it shows the following errors.
Seems it's prohibited to have more than one class in file. Please try to put each class in separate file. Then run should work fine.