eclipse 无法检查日食上的变量
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1171190/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Unable to inspect variables on eclipse
提问by
I'm unable to inspect variables on eclipse when debugging remote Java application. What could be the reason.
调试远程 Java 应用程序时,我无法检查 Eclipse 上的变量。可能是什么原因。
EDITED: I'm not able to inspect any variables. Message shown in inspector mini window is 'variable namecannot be resolved'. I'm able to see the contents when I run it locally with test code.
编辑:我无法检查任何变量。检查器迷你窗口中显示的消息是“无法解析变量名称”。当我使用测试代码在本地运行它时,我能够看到内容。
回答by Thorbj?rn Ravn Andersen
Be absolutely certain that the classes deployed to the remote server have been compiled with debug information.
绝对确定部署到远程服务器的类已使用调试信息进行编译。
回答by Alessandro Dionisi
In my case I was compiling the project through Maven with debug=false for the compiler-plugin. This was the problem!
在我的情况下,我通过 Maven 编译项目,编译器插件使用 debug=false。这就是问题所在!
回答by Marcin Cylke
Check that you're connected to the remote app.
检查您是否已连接到远程应用程序。
If your application has multiple threads, it might be that no thread is selected, in this case - select the thread that debugger stop in.
如果您的应用程序有多个线程,则可能没有选择任何线程,在这种情况下 - 选择调试器停止的线程。
If debugger hasn't stopped - set a breakpoint.
如果调试器没有停止 - 设置一个断点。
回答by James K
I recently encountered the same problem and checked that all classes were compiled with debug info and they were.
我最近遇到了同样的问题,并检查了所有类是否都使用调试信息进行了编译,并且确实如此。
I found the problem to be that the local source was slightly out of date. The source of the code I was debugging had not changed between the two versions but the problem was still occurring. Once I updated from Subversion and rebuilt locally the problem was resolved.
我发现问题是本地源有点过时了。我正在调试的代码源在两个版本之间没有改变,但问题仍然存在。一旦我从 Subversion 更新并在本地重建,问题就解决了。
回答by akf
There are two views by which you can see values while debugging in Eclipse. First is the Expressions view. In the Expressions view you can see values for fields that you indicate you want to 'watch.' Second is the 'Values' view. In the Values view, you can see the values for fields in a method that you are stepping through, if the class was compiled with debug tokens, or the values of the arguments passed in if the class was not compiled with debug on.
在 Eclipse 中进行调试时,您可以通过两个视图查看值。首先是表达式视图。在“表达式”视图中,您可以看到表示要“观察”的字段的值。其次是“价值观”的观点。在 Values 视图中,如果类是使用调试标记编译的,您可以看到正在逐步执行的方法中字段的值,或者如果类不是在调试时编译的,则可以看到传入的参数值。
If you are seeing something like 'Variable name cannot be resolved' it could be that you are using the Expressions view, not the Values view.
如果您看到类似“无法解析变量名称”的内容,则可能是您使用的是表达式视图,而不是值视图。
回答by Aaron Digulla
All variables or just some? There could be several reasons for this:
所有变量还是只是一些变量?这可能有几个原因:
There is no debugging info available for that class. You wouldn't see the variables either when debugging the same code locally.
Maybe there is a bug in Eclipse. Did you check the error console?
I'm not sure whether the version of the VM makes any difference. But you should try to use the same VM on both sides to make sure.
该类没有可用的调试信息。在本地调试相同的代码时,您也不会看到这些变量。
也许 Eclipse 中存在错误。你检查错误控制台了吗?
我不确定 VM 的版本是否有任何区别。但是您应该尝试在两侧使用相同的 VM 以确保。
回答by Sudip Bhandari
There could be many possible reasons behind. Are you in 'proper context'? If your debugger is at one context or stack frame and you are trying to inspect variables that are not in that scope then you won't be able to inspect them.
背后可能有很多可能的原因。你在“适当的背景下”吗?如果您的调试器在一个上下文或堆栈框架中,并且您试图检查不在该范围内的变量,那么您将无法检查它们。
回答by Christian Weaves
I had this problem after switching to building with maven. To get round the problem I added the tag to the compilerArguments tag in the pom.xml. Find the maven compiler-plugin tag and modify it so it looks something like below, the new tag you are interested in adding is the empty tag!!:
切换到使用 maven 构建后,我遇到了这个问题。为了解决这个问题,我将标记添加到 pom.xml 中的 compilerArguments 标记中。找到 maven compiler-plugin 标签并修改它,使它看起来像下面这样,你有兴趣添加的新标签是空标签!!:
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<compilerArguments>
<source>1.8</source>
<target>1.8</target>
<g></g>
</compilerArguments>
</configuration>
</plugin>