Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Wrong project is being run in Eclipse

Tags:

java

eclipse

I wrote some java code in Eclipse. When I run it, I see the output of another project (that I wrote before) in the console. How can I see the output of my new code?

like image 571
khadije Avatar asked Jan 23 '15 16:01

khadije


People also ask

Why won't my project run as it should?

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.

Why does eclipse run multiple projects at the same time?

Trying to guess your problem: When you press the Run as button (White arrow in green circle), Eclipse doesn't run the program you're editing. Instead, it runs again the last program you executed. That's the reason why you see the output of another project: You're telling Eclipse to repeat its execution.

Why do I see the output of another project in Eclipse?

That's the reason why you see the output of another project: You're telling Eclipse to repeat its execution. So, to run your new app, right click over the code and select Run as/Java application.

How do I run a Java program in Eclipse?

Instead, it runs again the last program you executed. That's the reason why you see the output of another project: You're telling Eclipse to repeat its execution. So, to run your new app, right click over the code and select Run as/Java application.


2 Answers

Trying to guess your problem: When you press the Run as button (White arrow in green circle), Eclipse doesn't run the program you're editing. Instead, it runs again the last program you executed. That's the reason why you see the output of another project: You're telling Eclipse to repeat its execution.

So, to run your new app, right click over the code and select Run as/Java application.

like image 160
Andres Avatar answered Oct 11 '22 19:10

Andres


Right click your project in the project explorer. And then this menu will pop up: enter image description here

Click Run As > Java Application

like image 42
Ravin Sardal Avatar answered Oct 11 '22 18:10

Ravin Sardal