Why did JavaFX fail

The javafx.application icon in the IntelliJ Idea IDE cannot be resolved

I tried one JavaFX Building application in IntelliJ Idea IDE but got a compilation error stating:

java: Package javafx.application does not exist.

I changed the Project SDK and Project Language Level to Java 8, reloaded the project, but it didn't help. Then I checked whether the JavaFX plugin was activated in the settings.

Searching Google and StackOverflow didn't give me any further ideas as to what is wrong. Thanks for any help in advance.

PS I am using IntelliJ Idea 14.0 with java8.1.0_25 on Archlinux OS.


As stated here, JavaFX is no longer included in openjdk.

So do you check that you have under on your classpath? If not, that could be the reason. Try adding it and see if that fixes your problem e.g. B. under Ubuntu. Then install the openjfx package with.

This should be your perfect solution. Try and enjoy. If a command isn't working properly, if you get an error, try fixing it yourself. I gave you the main thing you need. If your application is in a different location or your system architecture is different, solve it yourself. It is very easy to do that. Just follow my given solution.

Step 0:

Step 1

Step 2:

Step 3:

Step 4:

Now open a new project or recreate your project. Good luck.

You can use the one that came with IntelliJ:.

You need to download the java-openjfx package from the Arch Linux official repos. (Also make sure you have the openjdk8-openjdk package). Then open your project in Intellij and go to Project Structure -> SDKs -> 1.8 -> Class Path. Remove the old JDK and click the directory for the new JDK, which now contains jfxrt.jar.

You may have a lower project language level than your JDK.

Check whether: "Project structure / Project / Project-> Language level" is lower than your JDK. I had the same problem with JDK 9 and the language level was set to 6 by default.

I set the project language level to 9 and after that everything worked fine.

You may have the same problem.

Another way to solve the problem: Left-click the project folder in the project structure on the left and click "Open module settings" in the list of actions. In the new windows, click SDKs Title Platform Settings in the menu, then check the Class Path list to see if you can find the path to the jfxrt plugin. If not, click on the + symbol on the right and select the repertoire of the jfxrt plugin (C: \ Program Files \ Java \ jdk1.8.0 \ jre \ lib \ ext \ jfxrt.jar on my desktop)

Example of a Java application:

I am posting my answer from another question here as it is related and also seems to solve the problem in the question.

Here is my sample project with OpenJDK 12, JavaFX 12 and Gradle 5.4

  • Opens a JavaFX window with the title "Hello World!"
  • Can create a working zip executable for distribution (Windows needs to be tested)
  • Can be opened and run in IntelliJ without additional configuration
  • Can be run from the command line

Hope someone finds the Github project useful.

Instructions for the Scala- Case:

The following are also instructions that come with the Gradle Scala- Plugin work, however doesn't seem to work with Java . I'll leave this here in case anyone else is also using Scala, Gradle, and JavaFX.

1) As mentioned in the question, the JavaFX Gradle plugin needs to be set up. Open JavaFX has extensive documentation on this

2) You also need the JavaFX SDK for your platform, which is unpacked somewhere. NOTE: Make sure you scroll down to the section " Latest versions " scroll, in which JavaFX 12 (LTS 11 comes first for some reason.)

3) Then go to IntelliJ, press the ➕ button and add the folder from the unzipped JavaFX SDK.

Refer to the excellent Open JavaFX documents for IntelliJ for further instructions with screenshots. I can't get a deep link working. So select and then in the document navigation. Then scroll down to step. Also, check out the other steps if you're having problems.

It's hard to say if this is exactly the same situation as in the original question, but it looked similar enough that I ended up here, so I'm adding my experience here to help others.

In IntelliJ Idea,

Check that the following things are configured correctly:

Step 1:

Browse File -> Settings -> Plugins -> javafx and make sure it is enabled.

Step 2: project structure (Ctrl + Shift + Alt + s)

Platform settings -> SDKs -> 1.8 -> Put Sure you have classpath Contains "jre \ lib \ ext \ jfxrt.jar".

Step 3:

Project Settings -> Project -> Project SDK - should be selected 1.8

Project settings -> Project -> Project language level - configured as 8

Ubuntu: If you didn't find jfxrt.jar in your SDKs, install sudo apt-get install openjfx

I had that same problem , in my case i solved it through :

1) Go to File -> Project Structure ----> Global Libraries. 2) Look for jfxrt.jar, which is included in jdk1.8.0_241 \ lib by default (after installation). 3) Click + in the top left to add new global library and I have given the path of my jdk1.8.0_241. Example: (C: \ Program Files \ Java \ jdk1.8.0_241).

i hope this will help you

We use cookies and other tracking technologies to improve your browsing experience on our website, to show you personalized content and targeted ads, to analyze our website traffic, and to understand where our visitors are coming from.

By continuing, you consent to our use of cookies and other tracking technologies and affirm you're at least 16 years old or have consent from a parent or guardian.

You can read details in our Cookie policy and Privacy policy.