Import QuPath Source code into eclipse maven project - Class not found exception

202 views
Skip to first unread message

Phil

unread,
Jul 18, 2018, 2:02:50 PM7/18/18
to QuPath users
Hello to all, I'm trying to import QuPath into eclipse. Everything related to the import with maven was successful. However, I can not start the Main class because I get java.lang.ClassNotFoundException: qupath.QuPath, although I have used the maven goals install and compile successfully. Can someone help me? Thank you
run qupath.png

Pete

unread,
Jul 18, 2018, 2:08:46 PM7/18/18
to QuPath users
It's possible, but awkward... I'd recommend trying my fork, as described at https://petebankhead.github.io/qupath/2018/03/19/qupath-updates.html

I've switched to using Gradle, which will become the new standard once the changes are eventually merged back into the main QuPath repository.  This should make it much easier to build, and also to set up in an IDE (either IntelliJ or eclipse).  Also, it has quite a few fixes and improvements.

Pete

unread,
Jul 18, 2018, 2:21:37 PM7/18/18
to QuPath users
These were the old instructions for setting up v0.1.2 in eclipse: https://github.com/qupath/qupath/tree/v0.1.2/src/main/resources/eclipse

Not all steps may be required with Gradle, but since you're using Windows you will need to set the working directory to be one that contains the OpenSlide binaries if you want OpenSlide support.  You'll also need a Java 8 JDK (it requires different dependencies for Java 9/10 support).

I've attached a couple of screenshots showing my Run/Debug Configuration with using my fork (i.e. Gradle).  Three things to note under the 'Arguments' tab:
  • It's handy for debugging to put the full path to an image or project under 'Program arguments' (although I haven't done that here)
  • The VM arguments here are to aid with using VisualVM when looking for memory/performance trouble; you might also want to set -Xmx here as well to adjust the available memory
  • For my working directory, I built the software once with Gradle (outside eclipse) and then used the directory to which the binaries were copied as my working directory - making it possible to use a relative path (here on a Mac, but I guess it's similar for Windows)
Also, if you happen to have a later version of Java installed you might have some problem.  Creating a 'gradle.properties' file in the QuPath workspace containing 
org.gradle.java.home=/your/path/to/jdk-8
should help.
eclipse1.png
eclipse2.png

Phil

unread,
Jul 18, 2018, 2:46:59 PM7/18/18
to QuPath users
Great Pete !!! 
I had not copied the classpath and project files in QuPath project. 

Phil

unread,
Jul 19, 2018, 11:59:09 AM7/19/18
to QuPath users
Hi Pete, 
when I go to load images in qupath inside eclipse I get the following error:
 java.lang.UnsatisfiedLinkError: C:\workspace\qupath\deploy\natives\openslide-jni.dll: Can't find dependent libraries
It is as if he could not find the library even though the path is right. 
Can you help me please?

Pete

unread,
Jul 19, 2018, 12:08:02 PM7/19/18
to QuPath users
Have you sent the 'Working directory' (second screenshot) to be one containing openslide-jni.dll?

That's definitely necessary and I think it should be all you need to do, although if it doesn't work I can try to find out if I have configured something else.

If all else fails, if you have the QuPath Bio-Formats extension (https://github.com/qupath/qupath-bioformats-extension) installed then that should give an alternative way of accessing a range of whole slide image formats, and which doesn't require the working directory to be set.  But ideally OpenSlide should work as well.

Phil

unread,
Jul 19, 2018, 12:23:16 PM7/19/18
to QuPath users
If I configure working directory other:${workspace_loc:qupath/deploy/natives} works correctly.
Thanks as always
Reply all
Reply to author
Forward
0 new messages