This is something which should be know be every java developer: how to enable remote debugging of your java application. The solution is remarcable simple:

export JAVA_OPTS="-Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n"

and the start your application normally. You can use your IDE of choice for the debugging. Here is a screenshot of the eclipse configuration:

Remote java debug Remote java debug