eclipse how to run a different class

2019-05-26 15:54发布

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?

5条回答
成全新的幸福
2楼-- · 2019-05-26 16:33

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. :)

查看更多
我命由我不由天
3楼-- · 2019-05-26 16:41

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 :)

查看更多
Summer. ? 凉城
4楼-- · 2019-05-26 16:47

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. :)

查看更多
放荡不羁爱自由
5楼-- · 2019-05-26 16:53

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

查看更多
啃猪蹄的小仙女
6楼-- · 2019-05-26 16:56

main method is missing in your script:

public static void main(String[] args)
查看更多
登录 后发表回答