Debugging QuPath extension with intellij

Dear all,

I am looking to debug custom QuPath 0.2.3 extension with IntelliJ and was wondering if someone would have some tips on how to do it.
What I did so far is:

  • cloned qupath in intellij which created a new qupath project,
  • created another project fro my extension and added qupath as a module in it so the import of the qupath classes and dependencies will work.
  • Downloaded javaFX , unzip it and in intellij Go to File>Project structure, click on libraries , click on + and point to the lib directory of javafx (e.g., C:\javafx-sdk-11.0.2\lib )
  • Ran qupath from IntelliJ so I could run it in debug mode by running the class qupath.lib.gui.QuPathApp and add the following VM options:

--module-path "C:\GBW_MyPrograms\javafx-sdk-11.0.2\lib" --add-modules=javafx.fxml,javafx.base,javafx.controls,,javafx.web,,javafx.web,javafx.swing

In the build.gradle of my project I added a task to copy the extension jar to the QuPath extension folder, e.g.

task copyJarToQuPath (type: Copy) {
    from jar
    into "C:\\QuPath\\extensions"

What I am now missing is being able to debug my extension when qupath is running so if anyone has a tip…


I don’t have a solution to that – it’s definitely easier to set up an IDE to build an extension if it’s still within the same Gradle project (like the built-in extensions)… but that does rather mix up Gradle settings for when you ultimately want to separate it out again.

I do all my main development in eclipse; my run configuration is as below:

A few notes that may or may not help:

  • you shouldn’t really need do download the JavaFX libraries separately – that’s all handled by Gradle
  • I use qupath.QuPath as the main class
  • the working directory only really needs to be set for OpenSlide to be found
  • you might need to change the settings.gradle file within the main QuPath repo during debugging, pointing it to your extension; ideally, you’d avoid having to copy the jar to the extensions directory, and instead get the extension onto the classpath during launch – then QuPath will add it immediately anyway
1 Like

Thanks Pete for your quick answer

Actually, I realized that the debugging is already working in IntelliJ with my setting, I just need to run the task copyJarToQuPath before to run the qupath.lib.gui.QuPathApp in debug mode.

For javaFX, somehow it is needed to add the library directory to the project structure to run QuPathApp otherwise it down’t found the javaFX dependencies, we could probably link to the javaXF libs stored by gradle ( e.g. in .gradle\caches\modules-2\files-2.1\ ) but I am not sure exactly how so it was easier to re-downloaded it.

Thanks again for this software!