I have a strange problem that I never encountered before, with debugging in Eclipse. while debugging, when I break in new code, the variables in the function are not displayed in the "variables" window. The ones that are displayed are only those which were passed to the function as arguments, and they are displayed as arg(0), arg(1) etc, and not by thier names. when I want to watch or inspect a variable in the function, I get the message "such and such cannot be resolved". Some facts: 1. When I rome in the debug stack and look at other functions, the variables are displayed properly 2. The debug run is synchronised with my written code 3. The project that I work in is compiled with external tools (that are using ant). None of my fellow workers ever encountered such a problem although all of them compile with the external tool. 4. The eclipse is 3.2.1 version
This is a typical behaviour if you compile code without the -g
option.
In eclipse: right-click on the Project, select 'Properties' from the context menue and "Java Compiler". Check if "project specific settings" is enabled.
If it is enabled, check if all checkboxes in the lower area are selected, especially "Add variable attributes to generates class files".
If this checkbox is enabled but not selected, check it (press apply), if it is not enabled not selected, select "Configure Workspace Settings" and enable the missing functionality globally (my advice).
External tool - the javac
command needs the -g
option. Default behaviour (no -g) is not having local variable information. (Reference)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With