How to change run as java application settings in Eclipse

kalahari picture kalahari · Nov 1, 2014 · Viewed 10.8k times · Source

I am doing a Java project in Eclipse on Windows. I implemented some methods and tried to test them. But, in Eclipse run or run as seem to be empty.

When I try to right click to my project on package explorer and choose run as Java Application, a pop-up shows up and says Select Java Application. But the list under it looks like completely strange to me. And in the same pop-up, at the bottom there is a package name which is not my projects's package. Actually it is exactly the same package where I copied some methods with copy paste. (I changed them in my project). But it seems to be run settings somehow became default or something.

This is a school hw and my teacher gave me some files with method definitions. I created a project in Eclipse and copied the files into src folder.

So, the question is, how can I change this and run my own project? Thanks in advance...

NOTES: My project is a Java project. I am trying to connect from Eclipse to MySQL using JDBC and run some queries. Connector jar file is on place. Path settings seem to be right.

EDIT: My teacher wants me to implement an interface named ICPL. So I created a java file named CPL. My teacher also gave me a separate Main.java file.

main function class path run config main source

Answer

AsSiDe picture AsSiDe · Nov 1, 2014

Make Sure:

  1. you are working on the Jave Perspective . There are various prespective in Eclipse.
  2. when you created your project, have u selected file>new>Java Project.
  3. right click on you project in project explorer,then choose run configuratin,in the "type filter text" text box type "java application" ,select it and choose prespective link on the right side.
  4. select Java Application in "Application Type/Launchers:" list box. Then select "Java" in "Run" drop down box.

  5. apply>ok

  6. here you go.