views:

46

answers:

3

Hi, While debugging a variable in Eclipse that takes "true" but the same takes "false" when i run the code in Eclipse. What are all the possible reasons for this scenario?

Thx

A: 

Are you saying that the variable is 'true' during debugging, but become 'false' in normal run?

qichuan
+1  A: 

Several possibilities come to mind. My guess is that your launch configurations are different, and that influences the initialization of the variable.

Thorbjørn Ravn Andersen
This might be reason.But my case is not this.Thx
JavaUser
+1  A: 

If your application runs multiple threads (or receives op. system callbacks from another thread or something similar), it is possible, that your application contains race conditions: depending on the execution order different values get assigned.

Using a debugger can change execution times to bring forth the other order.

Zoltán Ujhelyi
Thx ...this is the exact scenario I got up with.As per you "Using a debugger can change execution times to bring forth the other order."How to achieve this in ECLIPSE.Please advice
JavaUser
I don't know of any IDE function that explicitly helps dealing with race conditions. Maybe you could try to (1) synchronize between the threads, or (2) use volatile/etc. variables to avoid this mess.
Zoltán Ujhelyi