eclipse出現Unable to evaluate the selected expression解決辦法


現象:

我的eclipse版本是Version: Photon Release (4.8.0),在調試spring boot源碼過程中遇到如下問題:

選中某個變量Ctrl+Shift+I查看變量內容的時候,總是彈出如下對話框:

 

 Unable to evaluate the selected expression:

To Perform an evaluation, an expression must be compiled in the context of a java project's build path. The Current execution context is not associated with a java project in the workspace.

另外在expressions的viewer中也無法查看變量值  

分析:

雙擊Breakpoints Viewer里面的斷點,打開的Class File Viewer,請注意我用黃色高亮顯示的部分:

 

 

 

 

 

從 Debug Viewer,雙擊頂部的調用棧項,實際顯示的Source Viewer

 

 經過對比發現,調用棧錯誤的關聯了source code,並沒有關聯Class File。Source Code Viewer並沒有調試的上下文信息,所以造成了Unable to evaluate the selected expression錯誤。初步分析應該是eclipse版本Version: Photon Release (4.8.0)這個版本的jdt有錯誤。

 

如何解決

臨時解決辦法1:

選中Debug viewer窗口中,選中該工程->右鍵選中Edit Source Lookup...

 

 

勾選Search for Duplicate source files on the path

 

 

 

重新運行程序走到斷點處系統會自動彈出如下對話框,選擇對應的.class文件,調試就可以關聯到class File Viewer類中了

 

 

選中某個變量,ctrl+shift+I 就可以正常查看spring boot的源碼了。

 

 

 

辦法2:

升級或者降級eclipse版本,我試了oxgen是可以正常運行的。

 

注意:網上另外一篇文章 https://blog.csdn.net/hehuihh/article/details/82589107 並沒有解決我的問題,雖然看到的現象是一樣的。

 


免責聲明!

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



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