其實主要原因是你沒有把自動編譯打開,也就是你每次保存你寫的代碼後,編譯器沒有自動編譯,只要你把自動編譯打開就可以,下面是打開自動編譯的方法:
如果說上面的做法行不通,就按照下面的方法修改一下代碼錯誤的提醒方式,然後修改完之後要確保自動編譯是打開的。
1.對單個項目修改
- 項目上右鍵–>properties–>java compiler–>building–>enable project specific setting–>build path problems–>選中abort
- Incomplete build path/Circular dependencies 這兩個選項修改爲Warning
2.對所有項目修改
- window->preferences->java->compiler->building->build path problems–>選中abort
- Incomplete build path/Circular dependencies 這兩個選項修改爲Warning