I know that you can debug a remote JVM starting it in “debug mode” (the remote JVM opens a TCP port to communicate with the debugger).
My question is, how is this communication done when the debug is not remote but local? for example, when you use an IDE to launch an application to debug it locally. The IDE launches the JVM in an independent process, and then how is this inter-process communication done (in the case of Windows, for example)? is it done throught a TCP port also?
That depends on the hosting OS. On Windows the debugger will use shared memory and there is a whole bunch of alternative ways of connecting on various OS’es:
http://download.oracle.com/javase/6/docs/technotes/guides/jpda/conninv.html
In earlier versions, TCP would be quietly used unless on Windows…
The details are, however, vendor specific and the Sun VM allows you to implement your own connector, if you want to implement one that works over another protocol: http://download.oracle.com/javase/1.5.0/docs/guide/jpda/jdi/com/sun/jdi/connect/spi/TransportService.html