Use a jar with source as source for jdb?
It may not be possible, as stated in this (very old) post on the forums.
If jdb is ignoring *.jar and *.zip entries for sourcepath
, maybe you can whip up a batchfile to expand the source from the target jar into a temp directory and point sourcepath
to that.
Something like this
MYDEBUGDIR=/temp/source/mydebug
jar -xf target.jar -C $MYDEBUGDIR
jdb -sourcepath ${MYDEBUGDIR} -classpath "${JAR_FILE}:${CLASS_PATH}" ${MAIN_CLASS} ${ARGS}
rmdir -r $MYDEBUGDIR
That way the debug source is in sync with the jar and it cleans up after itself.
actually I managed to debug into a jar file without source code today, the steps are as follows:
unzip jar file
jdb -sourcepath [unzipped source folder] -classpath [the path for your main class]
after jdb initializing, excute:
stop at <package>.<yourclass>:<linenunmber>
run <your main class, for example org.springframework.boot.loader.JarLauncher>
- after breakpoint triggered, you can step by step debug using jdb command