解决Myeclipse在调试(debug)时无法显示变量值问题(转载)

    突然发现myeclipse在调试时当鼠标放在变量上面时无法显示变量值了

ctrl+shift+i竟然提示cannot be resolved to a variable

在Variables里看到变量名是arg0,arg1之类

网上查到的最多的方法是

Window->Preferences->Java->Editor->Hovers 将[Variable Values]选择即可,如果[Combined Hover]已经勾选,取消并勾选[Variable Values]

这种方法没有解决我的问题(试了下竟然什么都不显示了)

    后来想起因为另外一个项目需要改过一个编译配置,果断将其改回,然后debug,一切正常

具体方法

右击工程->properties->Java Compiler->选中 "add variable attributes to generated class (used by the debugger)” 选项即可

这个涉及到java代码编译问题,简单点说就是你要调试的类的Class文件里没有包含LocalVariableTable属性表,选中这个的目的在Java源码编译器编译Java源码时得到Class文件里包含LocalVariableTable属性表

转载连接:   http://blog.csdn.net/guobing965816/article/details/23258669

 

 

 

引言: 

    eclipse新导入的项目经常可以看到“XX cannot be resolved to a type”的报错信息。本文将做以简单总结。 

正文: 

    (1)jdk不匹配(或不存在) 

    项目指定的jdk为“jdk1.6.0_18”,而当前eclipse使用的是“jdk1.6.0_22”。需要在BuildPath | Libraries,中做简单调整。 

    (2)jar包缺失或冲突 

    当找不到“XX”所在的jar包时,会报这个错。解决只需要找到(ctrl+点击,可能能看到jar包名称)对应jar包导入项目即可。 

    另外,出现相同的XX时也会报此错。可能需要调包、解包、选删。 

    (3)eclipse查找项目类型策略所致 

    eclipse下,上述两条都对比过了,没有任何问题,可偏偏还报这错。这时,需要操作一下 Project | Clean... ,问题即可解决。原因是,机制所致。因为某些特殊原因,eclipse没能自动编译源代码到build/classes(或其他classes目录),导致类型查找不到。 

 

Based on the comments here, I started checking how I could make sure that my Ant build 

wouldn’t interfere with my Eclipse build.

I found an option in Eclipse that clears up the problem (and is possibly more efficient than

 changing the 2 build system’s output folders).

Windows–>Preferences–>Java–>Compiler–>Building–>Output folder–>

”Rebuild class files modified by others”. This exists in Eclipse 3.5; I’m not sure about earlier versions.

Checking this seems to have fixed my problems.

 

reference link: http://www.cnblogs.com/xuxm2007/archive/2011/10/20/2219104.html

posted on 2015-01-06 10:50  三横一竖  阅读(885)  评论(0编辑  收藏  举报