I'm Siegfried. A developer. Yep.

Remote debugging with IntelliJ IDEA



Vagrant is a virtual development environment tool. It uses VirtualBox to create easy to use virtual server. A sweet goodbye to the “But it works on my computer !” when co workers can’t run the project… The vagrant box IP should be added to the hosts : mysite.local

IntelliJ Idea

IntelliJ Idea is a very nice IDE. I tried it last christmas because it was 75% off… And I can’t look back (I see you in the corner, Eclipse; stay there).


Debug configuration

Enable JVM debug

Edit /etc/default/tomcat7 (on Ubuntu) and uncomment the following line:

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

Enable Java debug in the jar

We use an ant task to generate our OpenCms modules. To enable debug, I have the following property :

<property name="java.opts.debug" value="on" /> <!-- "on" or "off" -->

And the javac task:

<javac srcdir="${folder.src}" destdir="${folder.build.jar.classes}" classpathref="compil.classpath" debug="${java.opts.debug}" debuglevel="lines,vars,source" source="1.5" target="1.5" />

IntelliJ IDEA

In the edit configuration :

Remote configuration in IntelliJ IDEA

Debug session

Start tomcat with the debug options, then, in IntelliJ IDEA:

Run debug tools in IntelliJ IDEA

This load the debugging tools from Intellij, and you can add breakpoints to your code and follow stuff…

Bi-Winning ?

Not yet. You can’t hot-deploy modified classes (or I haven’t found it yet) as you can do locally.

Word of the end ?

The end.