Nicholas Kong
Nicholas Kong

Reputation: 129

eclipse how to run a different class

I want to work on my different class lets say for example house.java but the green play button seems to be locked a program called project.java and only that program. how do I tell Eclipse to run a different classes in the same folder besides the project.java?

Upvotes: 2

Views: 20000

Answers (5)

Shravan Reddy
Shravan Reddy

Reputation: 1

main method is missing in your script:

public static void main(String[] args)

Upvotes: 0

Muhammad Imran Tariq
Muhammad Imran Tariq

Reputation: 23352

First thing to note that class you want to run should have main method in it. right click on that class and run as --> java application. it will run :)

Upvotes: 0

HashimR
HashimR

Reputation: 3833

Apart from ways mentioned in the other answers, you can also try this short key.

Short key : Press ALT + SHIFT + X then J

Hope this helps. :)

Upvotes: 2

Android Killer
Android Killer

Reputation: 18489

You can directly left click on your corresponding class code which you want to run and go to run as-->java application.hope this will help. :)

Upvotes: 1

Gryphius
Gryphius

Reputation: 78886

select your class, then select the small triangle right to the green button, in the dropdown select "Run As" -> "Java Application"

Upvotes: 2

Related Questions