Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IDE hangs in debug mode on break point in java fx application

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.

like image 521
vikki Avatar asked Jan 09 '15 14:01

vikki


People also ask

Why breakpoints are not working in Eclipse?

The solution was to enable it again, start a debug session, the breakpoint is hit and shown in the UI, then disable again the option. There is also another simpler way that will make Eclipse show the debugging highlight at the breakpoint or rather refresh the debugging UI to work as it should.

Why does IntelliJ debugger take so long?

Remove breakpoints off your method and use them inside the method as that can cause your debug to take a very long time. Try running IntelliJ as admin. I had this issue at work where debugging was extremely slow and running as admin actually made it a lot faster.

How do I run a Java program in debug mode?

A Java program can be debugged simply by right clicking on the Java editor class file from Package explorer. Select Debug As → Java Application or use the shortcut Alt + Shift + D, J instead. Either actions mentioned above creates a new Debug Launch Configuration and uses it to start the Java application.


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.

like image 112
user2163960 Avatar answered Sep 19 '22 15:09

user2163960


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); 
like image 38
Aaron Digulla Avatar answered Sep 19 '22 15:09

Aaron Digulla