Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Eclipse is running the wrong class [closed]

Tags:

java

eclipse

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.

like image 812
Abbac Avatar asked Dec 18 '11 16:12

Abbac


1 Answers

enter image description here

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:

  • edit the project if necessary (it won't be, using the right-click method)
  • enter the class where the main method of interest resides
  • give the configuration a reasonable name (optional, but handy)

Now you have a convenient way of selecting which main method you want to execute.

like image 134
Dave Newton Avatar answered Oct 23 '22 14:10

Dave Newton