Results 1 to 3 of 3
  1. #1
    willisduke3 is offline Member
    Join Date
    Feb 2012
    Posts
    2
    Rep Power
    0

    Default Eclipse runs a previous class and won't run the current class

    I think this is going to turn out to be a pretty straightforward answer. It is one of those things that after you have used an IDE for a few months, you just run your class and all is well. I am learning Java/Eclipse and can't find an answer to this anywhere on the web.

    Usually when I want to run a class I select Run from the tool bar and the current class is run. Sometimes I will Rt Click the class > Run and it runs. Then when I want to run another class I follow the above steps and that new class runs.

    1 out of 20 times I run my class as described above and my class does not run. The console tab lists a different class that was run, one I was running earlier in the day.

    How do I get Eclipse to stop running the old class, and run the one I Rt click > Run As on? I'm sure I have inadvertently modified how Eclipse works with the previous or current class.

    I just shut Eclipse down and restarted it. I clicked the green right arrow in the toolbad and it ran the previous class. Then I Rt. Click > Run configurations the new class and it shows me the Run Configurations window, with Name: "OldClass". Under Main Class: if I click Search, my new class is not listed. I'm sure this is closer to the problem.


    Thanks in advance,


    willisduke3

  2. #2
    KevinWorkman's Avatar
    KevinWorkman is online now Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    4,037
    Rep Power
    10

    Default Re: Eclipse runs a previous class and won't run the current class

    Have you tried doing a refresh/clean?

    Does it work if you run from the command prompt?
    How to Ask Questions the Smart Way
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  3. #3
    willisduke3 is offline Member
    Join Date
    Feb 2012
    Posts
    2
    Rep Power
    0

    Default Re: Eclipse runs a previous class and won't run the current class

    Quote Originally Posted by willisduke3 View Post
    I think this is going to turn out to be a pretty straightforward answer.
    As I said... I know one thing that causes this issue, but I think there are other causes also becuase most of my training applications have had one class and they have all had a main method. The problem in this case was that I ran one class in a four class application without realizing there were three more classes in the application. The class I ran did not have a main method. Once I loaded the other three classes and started by running the class with the main method, it ran properly.


    willisduke3

Similar Threads

  1. Replies: 4
    Last Post: 05-08-2011, 10:00 PM
  2. Replies: 12
    Last Post: 04-22-2011, 12:17 AM
  3. Replies: 0
    Last Post: 03-27-2011, 06:49 AM
  4. Chat applet runs in Eclipse but not on webpage?
    By warydig in forum Java Applets
    Replies: 8
    Last Post: 09-01-2010, 04:54 PM
  5. How to unload previous class when it has loaded
    By luoluo in forum Advanced Java
    Replies: 4
    Last Post: 04-26-2010, 06:36 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •