Reputation: 974
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.
Upvotes: 2
Views: 15793
Reputation: 1846
Make Sure:
select Java Application in "Application Type/Launchers:" list box. Then select "Java" in "Run" drop down box.
apply>ok
Upvotes: 1
Reputation: 1261
Right click on the class that contains the main method and the use Run as Java application.
Or when you click on the project and have that multiple choice check for the class with a main method.
Great eclipse tutorial for beginners:
http://eclipsetutorial.sourceforge.net/workbench.html
http://eclipsetutorial.sourceforge.net/totalbeginner.html
http://eclipsetutorial.sourceforge.net/persistence.html
http://eclipsetutorial.sourceforge.net/debugger.html
Upvotes: 0
Reputation: 757
Do you have main method? Try Run - Run Configurations - Java Application and create new launch configuration.
Upvotes: 0