I have a method and want to examine variables inside it without debugging - is it possible in Java?
I do not want to write tons of code like:
Syste
It's not simple to read the values of local variables at runtime, even if you're a debugger. If there are no debug symbols in your class, there is no way at all to see local variables, even if you use a debugger.
The most simple solution to see the values is printing them with System.out.println()
or to use logging (slf4j).
If you want to example local variables at runtime without changing the code, you can try AOP (Aspect-oriented programming). Or you can use the same API that a debugger uses to examine the running VM.