Since today, I am getting a class not found error in Fiji when using javafx.geometry.Point3D. It runs without problems in IntelliJ, but not within Fiji.
Do you have an idea how to fix this?
(I think I had that issue before but do not remember the solution…)
[EDIT]: I was only depending on one small class of javafx so I could get rid of the dependency altogether. Thus, no real need for help, but still curious why it used to work and now doesn’t anymore (could also be that I, by mistake, changed something in some pom…)
Are you running this code with OpenJDK 8? Fiji standalone with its own Java?
If both answers yes, this is probably the cause: OpenJDK 8 does not ship with JavaFX and you have to install it manually (usually through package mangers of the operating system). I assume that you did install JavaFX through your operating system and the jdk you are using in IntelliJ is aware of this installation but the Fiji jdk is not. Try running Fiji with the system jdk instead and see if that works.
Also, if you are not using JavaFX for your GUI, I would not recommend using classes from it at all.
This is running: ImageJ 2.0.0-rc-69/1.52n; Java 1.8.0_66 [64-bit]; Linux 4.4.0-148-generic;
(It is the case that I have another copy of openjdk on my system,
but Fiji shouldn’t know about it, and I redid my test with that copy
of openjdk “hidden” with the same result.)
This script also runs the same on a separate copy of Fiji I keep
that I updated to ImageJ 2.0.0-rc-69/1.52o using Help > Update ImageJ....
So my naive conclusion is that my copy of Fiji shipped / ships with
As I understand it, JavaFX was a separate installation in the early days, then became part of Java 8 (at least the Oracle distribution), then left again in Java 11 (or thereabouts) and now finds a home on Maven Central. But I have a strong suspicion that these JavaFX 11 maven artefacts are not compatible with Java 8.
Given the Java licensing changes, the fact that OpenJDK 8 distributions don’t (yet?) contain JavaFX seems… troublesome. Furthermore, I wasn’t able to track down pre-built 32-bit versions of JavaFX, which is the main reason QuPath is 64-bit only.
Yes, I tested a while ago and it is not byte-code compatible. Java >= 10 is required if I remember correctly. We are currently restricted to Java 8 for our software but updating our software stack to Java 10 (or later) is on the agenda, and JavaFX Maven artifacts are one of the reasons.
As others have pointed out: OpenJDK does not include JavaFX.
I recently (within the past couple of months, IIRC) and hastily updated the macOS version of Fiji to ship with AdoptOpenJDK 8 instead of Oracle’s Java. This was mostly in an attempt to address this problem:
But also for licensing reasons, since looking forward, we need to ship Fiji with OpenJDK and not Oracle’s Java. And also to ship a JDK rather than a JRE, so that the Script Editor works out of the box with Java code, instead of giving cryptic errors—see e.g.:
I am planning to update Windows and Linux also to ship with OpenJDK. When that happens, JavaFX will stop working. The planned solution to avoid this is to update ImageJ, Fiji and friends to Java 11, since as mentioned JavaFX can be shipped as regular Java libraries with Java 11, and therefore distributed on ImageJ update sites rather than being part of the bundled Java itself.
It may be awhile longer before we can update to Java 11, though, and in the meantime, a couple of Fiji plugins relying on JavaFX are currently therefore broken on macOS. So in the shorter term, I was thinking about exploring including OpenJFX 8 into the bundled AdoptOpenJDK that we ship with Fiji. Would people find this helpful? If so, does anyone have the bandwidth to test it themselves by installing OpenJFX 8 into Fiji’s bundled Java across all of Windows, macOS and Linux?