Sunday, June 18, 2006

Debugging Java used in Cocoa apps with the Objective-C Bridge:

In relation to some work I was doing with Adium, I became frustrated at the lack of any way to deal with debugging java classes that are used via the Cocoa-Java bridge. In a moment of desperation, I sought out various means of debugging or profiling, and I accidentally found a valid solution:
add
-Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n

to the JVM arguments as specified in your application's Info.plist.
The way to do this is as follows:
<key>VMOptions</key>
<string>-Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n</string>


You can then connect to the application using the java debugger of your choice, the line to do this with jdb is
jdb -attach 8000


I've heard that I should try using something like Eclipse, so if you aren't up on debugging in the Java world I guess it's worth giving that a look. I've also heard good things about IntelliJ, but that costs a reasonable chunk of money.

0 Comments:

Post a Comment

<< Home