Eclipse ide cannot resolve variables in newly written functions

I have a strange problem that I have never encountered before with debugging in Eclipse. when debugging, when I break the new code, the variables in the function are not displayed in the "variables" window. Those that are displayed are those that were passed to the function as arguments, and they are displayed as arg (0), arg (1), etc., and not their names. when I want to look at or check a variable in a function, I get the message "this and the other cannot be resolved". Some facts: 1. When I push the debugging stack and look at other functions, the variables are displayed correctly 2. The debugging run is synchronized with my written code 3. The project in which I work is compiled using external tools (which use ant). None of my colleagues have ever encountered such a problem,although they were all compiled using an external tool. 4. Eclipse - version 3.2.1.

+3
source share
5 answers

This is typical behavior if you compile code without an option -g.

In eclipse: right-click Project, select "Properties" from the context menu and "Java Compiler". Check if "project specific settings" is enabled.

If it is turned on, check if all the checkboxes in the bottom pane are selected, especially "Add variable attributes to create class files."

If this checkbox is enabled but not selected, check it (click "Apply"), if it is not enabled it is not selected, select "Configure workspace settings" and allow the missing functions globally (my advice).


- javac -g. (no -g) . ()

+5

, " " . .

+1

, . Ant -Task.

0

.

  • , JDK, ,
  • Eclipse (, ), .
-1

When compiling with ant, make sure that this command is passed to javac parameters.

javac **debug="true" debuglevel="lines,vars,source"** target="1.6" source="1.6" srcdir="${project.src.dir}" destdir="${project.build.dir}" classpathref="classpath">
-1
source

Source: https://habr.com/ru/post/1768057/


All Articles