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,發現找不到這個。

以下是代碼

1 package test;
2 
3 public class test {
4 
5     static void main(String[] arg)
6     {
7         System.out.println("Hello World");
8     }
9 }

發現需要加一個public在static前,並且String的S必須為大寫,並且main一定要拼寫正確。改正后的代碼如下

package test;

public class test {

    public static void main(String[] arg)
    {
        System.out.println("Hello World");
    }
}

發現可以運行,成功輸出結果Hello World

 

2018.09.18


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM