首页 > 系统服务 > 详细

eclipse出现Unable to evaluate the selected expression解决办法

时间:2020-03-03 01:04:04      阅读:200      评论:0      收藏:0      [点我收藏+]

现象:

我的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 并没有解决我的问题,虽然看到的现象是一样的。

 

eclipse出现Unable to evaluate the selected expression解决办法

原文:https://www.cnblogs.com/pmh905001/p/12399195.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!