Search code examples
javadebuggingjarintellij-ideaimagej

How to debug into dynamically-loaded jars in IntelliJ


I'm writing a plugin for ImageJ, with an Ant script to put all the needed files into a jar. ImageJ loads all the jars in a directory, and I run my plugin. However, when I try to debug my program, IntelliJ claims that there was "No Executable code found at line x in class y". How might I go about fixing this?


Solution

  • Double check that source code you build corresponds to the classes packaged in the jar, they must be synchronized. If you have a jar loaded that is built from the older sources it may cause such problem. Also ensure that you compile with debug info enabled. If compilation is performed from Ant, you must specify debug=true attribute for the javac Ant task.

    If there is some obfuscation or bytecode manipulation involved in the Ant build, it may also cause issues when debugging.