表表达式在eclipse中没有显示java的值。

时间:2021-09-23 20:44:42

I am using eclipse helio with java.

我正在使用eclipse helio和java。

The watch expression option is not working for me when debugging my code

在调试代码时,watch表达式选项对我不起作用

If I am doing a watch on variable, I cant see the value of that variable in the watch view if i hoover with my mouse over the variable in the code i can see its value if I check the variable in the variables view I can see its value

如果我做一个关注变量,我不能看到这个变量的值在表视图中如果我用鼠标在胡佛变量在代码中我能看到它的价值如果我检查变量在变量视图中可以看到它的价值

but in the watch expressions window i cant see its value (and its a problem if i try to watch expressions for example)

但是在watch expressions窗口中,我看不到它的值了(举例来说,如果我想看一下expression,那就有问题了)

did anyone encounter this problem

有人遇到过这个问题吗

(it used to work fine and show values but then suddenly it stopped and i have no idea why)

(它曾经运行得很好,显示了价值,但突然它停止了,我不知道为什么)

thanks

谢谢

3 个解决方案

#1


12  

For me the problem had to do with a bad source path configuration for the project. There's a bunch of different ways to fix this, but one is to right-click on the thread while paused in the debugger, select "Edit Source Lookup...", and fiddle around with the paths specified there (see below).

对我来说,这个问题与项目糟糕的源路径配置有关。有很多不同的方法可以解决这个问题,其中之一是在调试器中暂停时右键单击线程,选择“编辑源查找…”,并使用指定的路径(见下)。

表表达式在eclipse中没有显示java的值。

In my case the problem was that I had specified the source lookup path as a "File System Directory". I was able to get my Expressions view working again by removing the "File System Directory" path and adding the source lookup as a "Java Project" instead.

在我的例子中,问题是我将源查找路径指定为“文件系统目录”。通过删除“文件系统目录”路径,并将源查找添加为“Java项目”,我能够使表达式视图再次工作。

You can check whether the problem is your source lookup path by opening the Debug -> Display view, and trying to evaluate a Java expression there. If you see a message like this, then your source lookup path is bad:

您可以通过打开Debug ->显示视图来检查问题是否是您的源查找路径,并尝试在那里评估Java表达式。如果您看到这样的消息,那么您的源查找路径是错误的:

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.

#2


3  

Typically (at least for simple cases) the expression view works. But sometimes it indeed stops showing the values.

通常(至少对于简单的情况)表达式视图可以工作。但有时它确实会停止显示值。

Usually refresh and clean of project + (sometimes) restart of eclipse help.

通常刷新和清理项目+(有时)重新启动eclipse帮助。

If you are able to see simple values and cannot see expression it sometimes because the class that is returned by expression does not appear in import list of current class. In this case I often try to write explicit cast to class into the watch expression and sometimes it helps.

如果您能够看到简单的值,但有时不能看到表达式,因为表达式返回的类不会出现在当前类的导入列表中。在这种情况下,我经常尝试在watch表达式中写入显式的cast到类中,有时它会有所帮助。

Good luck.

祝你好运。

#3


0  

In my case, while debugging against wildfly, my workspace somehow got corrupted after I opened as a maven project the sources of eclipselink 2.6.4.

在我的例子中,在对wildfly进行调试时,当我作为一个maven项目打开eclipselink 2.6.4的源代码后,我的工作空间不知怎么被破坏了。

After having open this maven project - that has all sort of dependencies you can image on oracle libraries - within my workspace the expressions and display view simply did not work any more. The variables view, while debugging continue to work as well as all the mouse overs.

在打开这个maven项目之后(该项目具有在oracle库上可以映像的所有依赖项),表达式和显示视图在我的工作空间中就不再工作了。变量视图,在调试的同时继续工作,就像所有的鼠标指针一样。

I then created a fresh new empty worksapace. Imported only the project I wanted to debug. Reconfigured wildfly server. And voila, expressions and display were back to work.

然后我又做了一个新的空工作。只导入我想要调试的项目。重新配置wildfly服务器。瞧,表情和展示又回来了。

So, I have no idea what what happened to my eclipse... but it appears to be related to the metadata in my workspace being fundamentally broken.

所以,我不知道我的日蚀发生了什么……但它似乎与我工作区的元数据基本断开有关。

Therefore, if you get the feeling that out of the blue lose the ability to properly debug in your workspace, it might be that your worksapce got hammered.

因此,如果您感到突然地失去了在工作空间中正确调试的能力,那么可能是您的工作环境遭到了破坏。

This appears to be what has happened to me. Finally, I am now back to being able to use the expressions on this new workspace.

这似乎就是发生在我身上的事。最后,我现在可以在新的工作区中使用表达式了。

#1


12  

For me the problem had to do with a bad source path configuration for the project. There's a bunch of different ways to fix this, but one is to right-click on the thread while paused in the debugger, select "Edit Source Lookup...", and fiddle around with the paths specified there (see below).

对我来说,这个问题与项目糟糕的源路径配置有关。有很多不同的方法可以解决这个问题,其中之一是在调试器中暂停时右键单击线程,选择“编辑源查找…”,并使用指定的路径(见下)。

表表达式在eclipse中没有显示java的值。

In my case the problem was that I had specified the source lookup path as a "File System Directory". I was able to get my Expressions view working again by removing the "File System Directory" path and adding the source lookup as a "Java Project" instead.

在我的例子中,问题是我将源查找路径指定为“文件系统目录”。通过删除“文件系统目录”路径,并将源查找添加为“Java项目”,我能够使表达式视图再次工作。

You can check whether the problem is your source lookup path by opening the Debug -> Display view, and trying to evaluate a Java expression there. If you see a message like this, then your source lookup path is bad:

您可以通过打开Debug ->显示视图来检查问题是否是您的源查找路径,并尝试在那里评估Java表达式。如果您看到这样的消息,那么您的源查找路径是错误的:

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.

#2


3  

Typically (at least for simple cases) the expression view works. But sometimes it indeed stops showing the values.

通常(至少对于简单的情况)表达式视图可以工作。但有时它确实会停止显示值。

Usually refresh and clean of project + (sometimes) restart of eclipse help.

通常刷新和清理项目+(有时)重新启动eclipse帮助。

If you are able to see simple values and cannot see expression it sometimes because the class that is returned by expression does not appear in import list of current class. In this case I often try to write explicit cast to class into the watch expression and sometimes it helps.

如果您能够看到简单的值,但有时不能看到表达式,因为表达式返回的类不会出现在当前类的导入列表中。在这种情况下,我经常尝试在watch表达式中写入显式的cast到类中,有时它会有所帮助。

Good luck.

祝你好运。

#3


0  

In my case, while debugging against wildfly, my workspace somehow got corrupted after I opened as a maven project the sources of eclipselink 2.6.4.

在我的例子中,在对wildfly进行调试时,当我作为一个maven项目打开eclipselink 2.6.4的源代码后,我的工作空间不知怎么被破坏了。

After having open this maven project - that has all sort of dependencies you can image on oracle libraries - within my workspace the expressions and display view simply did not work any more. The variables view, while debugging continue to work as well as all the mouse overs.

在打开这个maven项目之后(该项目具有在oracle库上可以映像的所有依赖项),表达式和显示视图在我的工作空间中就不再工作了。变量视图,在调试的同时继续工作,就像所有的鼠标指针一样。

I then created a fresh new empty worksapace. Imported only the project I wanted to debug. Reconfigured wildfly server. And voila, expressions and display were back to work.

然后我又做了一个新的空工作。只导入我想要调试的项目。重新配置wildfly服务器。瞧,表情和展示又回来了。

So, I have no idea what what happened to my eclipse... but it appears to be related to the metadata in my workspace being fundamentally broken.

所以,我不知道我的日蚀发生了什么……但它似乎与我工作区的元数据基本断开有关。

Therefore, if you get the feeling that out of the blue lose the ability to properly debug in your workspace, it might be that your worksapce got hammered.

因此,如果您感到突然地失去了在工作空间中正确调试的能力,那么可能是您的工作环境遭到了破坏。

This appears to be what has happened to me. Finally, I am now back to being able to use the expressions on this new workspace.

这似乎就是发生在我身上的事。最后,我现在可以在新的工作区中使用表达式了。