Expression view in debugger mode not showing values - Eclipse - java

I am using Eclipse debugger mode and for some reason, when I type an expression into the Expression view, no corresponding value shows up. Even when I type in the name of valid variables that are populated (I know they're valid and populated because the code is working as expected and I can see their value in the Variable view and when I hover over them, just not in the Expressions view). I have tried restarting Eclipse, refreshing/rebuilding projects and nothing seems to work. It was working absolutely fine earlier in the day and then suddenly stopped working mid debug without any changes in settings. Does anyone know why this has happened and how to fix it? (Just to clarify, I am not trying to view the expressions of anything like a lambda function which I know cannot be evaluated in Expression view).
Edit:
I think it has something to do with the fact that when I am debugging, Eclipse now stops at breakpoint in a new instance of that class but with a hollowed out J for Java next to the file name.

Turns out that the issue was in fact related to the edit I made to the original question. The hollowed out J for the file icon meant that while debugging, I was using the file as a resource instead of an actual compiled file. This caused the problem and also meant that changes I made to the code did not reflect because they weren't compiled. To resolve this I ensured that the projects I was using had the right dependencies and versions of other projects that are being used then refreshed gradle and restarted the server. That ensured that the desired file is actually compiled and not just used as a resource file.

You can use Debıg Shell panel to show value of variable.
You can open this panel with Perspectives -> Debug Shell
Note: On older versions of eclipse, the name of this panel was Display.

Related

Eclipse seems to think the CSS files are Java source code

I'm using Eclipse Eclipse IDE for Java Developers [Version: 2018-12 (4.10.0)
Build id: 20181214-0600] to develop a JavaFX project but I got some problems.
After a Java update, I've found several errors in my CSS files. Eclipse seems to think the CSS files are Java source code, as figured in the image below.
When I drag the mouse on a error, the description is "Syntax error on token 'Invalid character', interface expected" (because of # symbol)
I'm sure the code is correct because there are no errors before the latest java update to version 1.8.2.
Anyone can help me?
Most likely what happened here is what #Gianpio Benincasa said: You've created a new class, then in the file explorer you renamed it.
However, it's worth checking this one: Go to window/preferences, type 'associations' in the filter box to quickly nav to setting General>Editors>File Associations, and scroll through the file types list for *.css. Click on it, and check which editors are associated with it.
An eclipse with no particularly relevant plugins should only list 'Text Editor', and it should be marked as default. If you added plugins specifically for editing CSS, those will also be listed (and one of those is now probably default instead). Perhaps you or someone else went out of their way to add the java editor to this list somehow. If that is the case, simply make 'text editor' the default again (click it, click 'default'), then click on the java editor, and click 'remove'.
for eclipse that is a java class, in fact the icon has the "J". Probably when you created it you have created a new class and then have renamed it.
Create a new generic file instead a java class and copy the contents to the new file.
For create a generic file, rightclick and follow new-> other-> General-> files
Have a nice day

Eclipse debugger hover produces empty box, no variable value

I'm debugging a Java (Android) application in Eclipse Indigo. In the debug perspective, if I'm stopped at a breakpoint, when I hover over a variable to see its value it displays a blank, white box (where I assume the variable's value is supposed to appear?) but with no content. It does not seem to matter what kind of a variable it is, local or class-scope, static or instance, the box is just as blank.
I can see the variables I need to see in the variables tab of the debugger perspective, but it would be a lot more convenient to see them by hovering.
In Preferences>Java>Editor>Hovers I've tried it with both Variable Values and Combined Hover with no improvement. I'm running on Windows 7, if that matters.
N.B. I have read this thread: Eclipse: Hover broken in debug perspective
Try to hit the restore defaults as described in Eclipse: Hover broken in debug perspective. Make sure to stop your debug run and restart.
You might also check Eclipse's Debug view documentation.
Try refactoring a package in your project then trying it again.
Could also be a bug
https://bugs.eclipse.org/bugs/show_bug.cgi?id=357127
Which version are you using?
I am seeing the same thing on Ubuntu. I am using the program VcXSrv on my Windows 10 system to get program windows from Ubuntu.
I had to turn off The 'Native opengl' option in the XLauncher when starting VcXSrv to get the hover text to appear.

Android : The Missing R

I have seen alot of cases of "R cannot be resolved to a variable". Though my case is odd.
It was working perfectly about 15 minutes ago and within that frame, R has now vanished and cleaning the project won't cut it.
I have also ensured that all of my SDK parts are up to date before and after the incident. And the problem still occurs.
Can anyone figure out a solution as to why it would disappear just like that? Even though the SDK was up to date before R vanished?
And another question. Why does this R file cause so much trouble? (I am using Eclipse btw)
This can certainly be a nuisance.
Make sure any R. imports haven't sneaked their way in. Your imports should be bereft of any 'R.'
If you have changed your package name recently, ensure that AndroidManifest.xml is still pointing to the correct package. Using eclipse to refactor does not guarantee the manifest will update.
A side note, if you have errors in your xml files (layouts etc) this will cause a Resource error. Not all errors will be caught by eclipse, so you have to go through those files with a fine comb.
Sometimes simply cleaning, closing and restarting eclipse can help.
Check if you've recently added some music or pictures (any type of resource generally) to your res folder structure. Name of resource must be in lowercase completely, must not start with number...
Also look at the output in the eclipse console. It sometimes show error messages if it can't generate R.java

Eclipse debug variable values don't appear

I'm currently coding with Java in Eclipse, and I'm trying to use Eclipse's built in debugger to try and debug my code. However, once I enter debug mode and try to run the program till the breakpoint, the variables aren't showing up in the variable window. Any ideas?
Make sure you're not in the Breakpoints tab as opposed to the Variables tab on the top-right window in the Debug perspective. When in doubt, simply go to Window > Show View > Variables.
This is usually caused by a rendering bug in Eclipse. Often letting the application run past the breakpoint, then trying to re-run again to the breakpoint fixes the display. Other times you have to restart the IDE.
I just had a similar problem, I could only see method arguments and this members, but not local variables. I was searching in all possible project settings and found out this checkbox ("Add variable attributes to generated class files") wasn't checked. Make sure all 3 options (used by debugger) are on :

Watch expression doesnt show value in eclipse with java

I am using eclipse helio with java.
The watch expression option is not working for me when debugging my code
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)
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
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).
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.
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:
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.
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.
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.
Good luck.
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.
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.
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.
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.

Categories