I am trying to get start with Kotlin
and TornadoFX
.
I have download Java jdk8u252-b09
and set it as my project SDK. See the following image:
I have seen this post that inform us that the Unresolved reference: javafx‘s bugg is linked to the fact of running a version of Java greater or equal to v11 without importing JavaFX in the project.
I have read the v8 of Java come with JavaFX integrated. And in my project as I have already said, I am running Java 1.8 as SDK. So this problem should be prevented to occur.
Still, when I “debug run” my debug console returns me:
Unresolved reference: javafx
as in the following image:
The only place I see that could be problematic is the software running in my machine. When I am running java –version in a linux terminal it returns me:
openjdk 11.0.7 2020-04-14
Since I am on Debian Buster it seems openjdk 11 is the oldest version supported by the OS-version. So if the problem is linked to the openjdk installed in the system I am wondering if there is any workaround beside running a virtual machine. Also I would think that the SDK installed in IntelliJ IDEA would overcome the Java version installed in my system in the context of my project, hence preventing the software installed in my machine to cause any problem to run my project.
So how my bugg is possible? What can I do to fix that?
2
Answers
In fact in the OpenJDK8 build that I have downloaded the
jfxrt.jar
was missing.So I have download a
jfxrt.jar
alone and included it in my/jdk8u252-b09/jre/lib/ext/
folder.Then the console returned me that a toolkit was missing.
So, in in
/jdk8u252-b09/
, I have just completely replaced the original jre ofjdk8u252-b09
with the one provided by https://java.com/en/download/linux_manual.jsp.In this case ensure effectively that in your Project Structure, in your "Module" part -> "Dependencies" tab, your dependencies point to the relevant folder [thanks DoombringerBG].
The same for your project's SDK, ensure that it is up to date.
Concerning your library it should know be okay because of the inclusion of JavaFX in your Java8 folder tree.
In one word, ensure your project is up to date with your replacement of you jre folder.
Now my project works fine.
I have found that most OpenJDK8s do not include JavaFX. I know of two that do that you may want to try to make future updates easier:
Liberica provides builds for raspberry pi and a wide variety of other architectures. If you need that, Liberica is the way to go.