The following describes how to set up a remote debugging session with a running jython application (or any java application for that matter).

Basically, you just:

Java Command Line To Startup The App

Here's what mine looks like to run from the jar:

C:\apps\j2sdk1.4.2\jre\bin\java.exe -Xnoagent -Djava.compiler=NONE -Xdebug -Xrunjdwp:server=y,transport=dt_socket,address=8000 -Dpython.home=C:\\workspace\\JythonTip\\jython\\dist -jar c:\workspace\JythonTip\jython\dist\jython.jar

or to run from the class directories:

C:\apps\j2sdk1.4.2\jre\bin\java.exe -Xnoagent -Djava.compiler=NONE -Xdebug -Xrunjdwp:server=y,transport=dt_socket,address=8000 -classpath <very long classpath> org.python.util.jython

Eclipse hint: external java command "snarfing" tip

And here's what the options mean:

Command Line Option

Meaning

-Xnoagent

Disables the old sun.tools.debug agent

-Djava.compiler=NONE

Turn off JIT compilation (required in order to use the "classic" debugger)

-XDebug

Enable debugging

-Xrunjdwp:<options>

Enable the Java Debug Wire Protocol

And here's the <options>:

JDWP Option

Meaning

server=y

Tell the app to listen for debugging connections

transport=dt_socket

We're going to use a socket (see below for other options)

address=8000

The socket to listen on

Note: Once you hit enter, the app may not respond like it normally does. For the jython interpreter, it seems to "hang". But once you attach your debugger to it (below), it will respond with the familiar propmt--kind of like "lazy initialization".

See below for further references...

IDE Settings

For Eclipse:

This will take you into the app at the first breakpoint.

For NetBeans:
[^http://debuggercore.netbeans.org/docs/VM-options.html netbeans vm options for debugging]

I have used this technique also for debugging a development Tomcat server remotely (see article below). Keep in mind that in a multithreaded environment, all threads will get stopped at your breakpoint, so be warned if this is not a private workspace.

References


Eclipse External Command "Snarfing" Tip

If you have an app that you run inside eclipse and you want to run it standalone (in a shell), you can get at the launch command that Eclipse uses:

ClarkUpdike/RemoteJythonDebugging (last edited 2014-04-30 04:30:00 by AdamBurke)