Eclipse下Debug時彈出錯誤“Unable to install breakpoint due to missing line number attributes,Modify compiler options togenerate line number attributes"
遇到這個錯誤時找到的解答方案匯總:
1、使用Ant編譯時,未打開debug開關,在寫javac 任務時確認debug=true,否則不能調試。THe settings for the eclipse compiler don't affect the ant build and even if you launch the ant build from within eclipse. ant controls it's own compiler settings.you can tell ant to generate debugging info like this 'javac ... debug="true".../>(我的問題是因為這個原因);
2、編譯器的設置問題,window->preferences->java->Compiler在compiler起始頁,classfile Generation區域中確認已經勾選了All line number attributes to generated class files。如果已經勾選,從新來一下再Apply一下。或者從項目層次進行設定,項目屬性->java compiler同樣在起始頁,確定已經勾選
Eclipse報的這個錯,無非就這兩個原因造成的
回答2:
以前總是被這個問題困繞,也找不到解決的辦法,無意間才明白他是怎么回事,
這個問題根本原因是:你eclipse里的project 和
deploy 到web container(tomcat)里的project
對應不起來.
解決的辦法:從eclipse里redeploy,然后從eclipse里run,或者到web container里先把the project刪除,在從eclipse里deploy,然后從eclipse里run.
