一般來說是因為在eclipse 中使用錯誤的 jre standard VM開發環境
設定正確即可
詳細步驟:
- Go to Java->Installed JREs. Add your JDK as a runtime. You may choose to select this JDK to use for all your FUTURE projects. However your selection will not take effect on existing projects. Hence onto step 2.
- Select your project's properties. Select Java Build Path.
- Under the Libraries tab, select JRE System Library [jreblahblahblah] and Edit it.
- Select Alternate JRE and use the dropdown to find the JDK that you just added.
- Clean your project and rebuild.
參考:
null JavaCompiler in Eclipse
ToolProvider.getSystemJavaCompiler() returns null - usable with only JRE installed?
沒有留言 :
張貼留言