Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set a variable equal to null in debug mode within eclipse

Tags:

java

eclipse

Trying to debug a NPE from a remote machine on eclipse, I cannot recreate the test case so wish to set the variable equal to null during runtime within the debug variables however. I am only given two options to set it, to a string (it's type) and via expression. I have tried via expression entering null and = null. However it does not allow me to do it.

edit: I enter

null 

=null

However I get the error message evaluations must contain either an expression or a block of well-formed statements

like image 510
Will Avatar asked Nov 04 '25 17:11

Will


1 Answers

You can use Display View for that. Windows -> Show View -> Display

Enter your expression in the Display Tab and execute it. You can see the execute buttons on top right corner with letter J on them. Simple execute yourVar = null;. It should set yourVar to null.

like image 66
Aniket Thakur Avatar answered Nov 07 '25 09:11

Aniket Thakur



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!