I have created a class, and wrote some code. When I try to run it, it runs the previous class that I was in. How do I make it run the class that I am in? When I try to run a different class than this one, it runs perfectly.
Your run configuration is wrong.
Under the Run
menu there's a Run Configurations
option. That defines the various run configs for your projects. You need to add a new one that runs whatever it is you're interested in.
Run configurations are also accessible by right-clicking in a Java source file, selecting Run As...
, and Run Configurations
.
Once you're in the run configuration dialog:
main
method of interest residesNow you have a convenient way of selecting which main
method you want to execute.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With