I have a problem while debugging in IntelliJ IDEA, it hangs in debug mode on break point in listeners in javafx application. I tried to increase heap space, but it's not help. Maybe someone had such problem too, please, suggest me what to do.
2 Answers
Set this as a VM parameter:
-Dsun.awt.disablegrab=true
It will mess up drag-and-drop, and leave an artifact on your screen while the debugger is paused - but it will let you debug. It happens whenever you block the JavaFX thread.

- 321,842
- 108
- 597
- 820

- 1,871
- 19
- 22
-
1Thanks, I was pulling my hair out with this one. – Ilia Choly Jun 23 '16 at 19:16
-
2Thank you! My laptop (running Ubuntu 16.04) froze when I tried to debug an old application (the only way out was ctrl+alt+f1 and running `sudo killall java`), but this helped :) – L42 May 29 '17 at 07:11
-
1you've life savior. This problem drives me craze. Thanks – Arash Sep 01 '18 at 12:33
-
Works for eclipse too! – Benjamin Peter Jan 14 '20 at 10:31
-
thanks, it does apply to awt too, i am not using javafx in my application, i added this option ias VM option within my running configuration. Ubuntu 18.10. – philippe lhardy Nov 05 '20 at 20:35
This can happen for a simple reason: The application has a lock on the desktop, for example a modal dialog or a popup or an open menu. Then it stops in a breakpoint. This notifies the IDE. Now the IDE tries to do something on your desktop but can't since the application still has a lock on the whole desktop -> deadlock.
You can use a tool like Chronon which records the whole program and lets you move back and forth on the timeline.
The last option is logging or poor man's debugger (System.out
) instead.
[EDIT]
it's hard to check with System.out which of 20 parameters not equal.
It's actually pretty easy:
System.out.println("check");
if(!a1.equals(b2)) System.out.println(a1+"!="+b1);
Then duplicate the last line. That way, you will only get output when something is actually interesting (and not for the 19 equal parameters). Add some patterns to the output if you can't distinguish aX
from aY
(i.e. both are true
):
if(!a1.equals(b2)) System.out.println("a1:"+a1+"!="+b1);

- 321,842
- 108
- 597
- 820
-
If I have to check for equals two object with 20 parameters, and it's return false, but I actually expected true, it's hard to check with System.out which of 20 parameters not equal. Also none of my colleagues don't have such problem in debug in listeners, but they also don't have any idea what's wrong, we all have the same hardware, OS and environment. – vikki Jan 09 '15 at 16:21
-
I like the explanation here, but not the solution. I'm trying to make my debugger work on Ubuntu, I need it to work. I don't have these issues with the same IDE and same application on my OSX machine. What are my options? – craigmiller160 Apr 01 '16 at 18:46
-
@user2223059 You can use the command line option in the accepted answer, use logging, [Chronon](http://chrononsystems.com/) or you can create a new, lock-free desktop for Linux. – Aaron Digulla Apr 02 '16 at 15:07