0

I'm using Ubuntu 20.04 OS. I got

package javafx.application does not exist

error.I read all articles related to topic. I both set my default Java version 8 and also add the openjfx to the Intellij as module and library. Even if I tried solutions I found, still my problem doesn't solved. May it be related to something else that I didn't consider? Which other things I should also check?

Thanks a lot.

jewelsea
  • 150,031
  • 14
  • 366
  • 406
  • Can you find this file in your JDK? `jdk/jre/lib/ext/jfxrt.jar` Did you install openjfx? See: https://stackoverflow.com/a/27178988/2138953 – PAX Jan 26 '23 at 11:24
  • In path: /usr/lib/jvm/java-8-openjdk-amd64/jre/lib/ext there is no file named jfxrt.jar. I already installed openjfx (it is in downloads) by looking the answer you shared. And also added the things in it's lib folder to intellij. @PAX – asuman_sare Jan 26 '23 at 11:41
  • 1
    why do you want to use an utterly outdated java/fx version (assuming it's 8 from the folder name)? – kleopatra Jan 26 '23 at 12:03
  • Because prerequisite of the github repo I followed is having Java 8 version, it doesn't work otherwise. @kleopatra – asuman_sare Jan 26 '23 at 13:06
  • how unfortunate .. thanks for the info – kleopatra Jan 26 '23 at 13:53
  • _I read all articles related to topic_ a bold statement ;) Maybe you missed https://stackoverflow.com/questions/61783369/install-openjdkopenjfx-8-on-ubuntu-20 which looks like a straightforward step-by-step instruction – kleopatra Jan 26 '23 at 14:00

2 Answers2

0

If you are working with Java 8, the easiest thing to do (and what I recommend), is to use Oracle JDK 8, not OpenJDK.

Most OpenJDK distributions do not include JavaFX, but Oracle JDK 8 does.

jewelsea
  • 150,031
  • 14
  • 366
  • 406
-1

Downloading jfxrt.jar file from a github repo, and placing this file inside the necessary path, which is /usr/lib/jvm/java-8-openjdk-amd64/jre/lib/ext solves the problem :)

(For Ubuntu 20.04, and Java 8)

  • I don’t recommend this. JavaFX requires native code which is not included in `jfxrt.jar`. While adding `jxfrt.jar` to the path may allow a JavaFX app to compile, it won’t run correctly, because the required native code is not there. Even if the native code was separately added, it would need to be the correct code for the architecture and a binary match the downloaded `jfxrt.jar` native interfaces, which would be unlikely. – jewelsea Jan 27 '23 at 02:05
  • As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Jan 28 '23 at 09:23