mynethome.de

25. Juni 2011 um 12:00 Uhr

Java Swing Debugging with IDEA on Linux

Dieser Beitrag wird recht technisch, und damit davon möglichst viele was haben, geht’s auf Englisch weiter ;-)

Recently, I experienced some problems debugging an Java/Swing application on my Ubuntu Linux box using IntelliJ IDEA 10.5 . The problem is that java.awt grabs control of all input devices while running. If you place an breakpoint inside an swing method (e.g. related to drag&drop behavior), the debugger will stop there but you will not be able to continue due the lack of a way to send commands to your IDE/debugger – java.awt has blocked all input devices.

With Linux, fortunately, you can always hit Ctrl+F1 to switch to a console and use jps (as a nice alternative to ps -axf | grep java; but it can do much more – see the linked man-page ;-) ) to get the ID of the debugged thread and kill it (kill -9 ProcessID)

After some research i found the BugReport in Ubuntu Launch Pad which redirects to Orcale’s bug tracker: IDE (…) Debugger hangs process on Linux, which suggests the -Dsun.awt.disablegrab=true JVM parameter as a solution work-around.

Unfortunately, this doesn’t work for me – the UI gets still blocked.
At least, IDEA is capable of breakpoints writing messages to console (even evaluated ones; see configuring breakpoints), so I still don’t need to clutter the source-code with System.out.println()

Another nice thing i learned while trying to hunt this problem down, is the tool jstack which can be used to get an stack trace from any Java process at any time :)

So, up to now, I haven’t solved the problem but leanred once again some more bits and pieces of the javaversum. There is also a thread on this at the jetbrains forum.

If someone has any suggestions: You are more than welcome :)

Einen Kommentar schreiben


Gravatar unterstützt

mynethome.de wird erstellt mit WordPress
Beiträge (RSS) und Kommentare (RSS)

(c) 2005 - 2015 Markus Schlichting