Eclipse:The selection cannot be launched,and there are no recent launches

  刚刚装上eclipse,于是就想写个Java程序来试试。结果写好之后不管是点击 run  还是  debug 结果都会弹出一个窗口,内容为: The selection cannot be launched,and there are no recent launches !意思是该选项不能执行,最近没有执行的记录。

这是我写的Java程序

  

后来在网上找了很久都没找到想要的答案。都是说要:选择Run,点击执行 run as application。然后我点击了run,确找不到 run as application 。后来才发现是因为语法问题导致的出错。

纠正后的Java程序:

  

总结了一下,出现The selection cannot be launched,and there are no recent launches !问题时:

  1、先确定语法有没有问题,程序没有出现红色的波浪线并不代表就是没有问题。

  

  2、语法没有问题前提下,选中要执行的文件,点击右键,选择Run,点击执行 run as application。

纠正后执行出来的程序:

  

原文地址:https://www.cnblogs.com/ranter/p/6537621.html