Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

cannot resolve symbol javafx.application in IntelliJ Idea IDE

I tried to create a JavaFX application in IntelliJ Idea IDE but I got compile error that said:

java: package javafx.application does not exist.

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

The search on Google and StackOverflow didn't give me more ideas of what is wrong. Thank for any help in advance.

P.S. I am using IntelliJ Idea 14.0 with java8.1.0_25 on archlinux OS.

like image 507
rob111 Avatar asked Nov 27 '14 21:11

rob111


People also ask

Why JavaFX is not working in IntelliJ?

Make sure the JavaFX plugin is enabled To be able to work with JavaFX in IntelliJ IDEA, the JavaFX bundled plugin must be enabled: In the Settings/Preferences dialog ( Ctrl+Alt+S ), select Plugins. Switch to the Installed tab and make sure that the JavaFX plugin is enabled.

How do I fix JavaFX error?

If this is your case also, you can do fix this by simply right-clicking on the javaFX project folder-> Build Path-> Configure Build Path-> Select JavaFX SDK-> Remove library-> Select classpath -> add library-> user library-> select library-> apply. Save this answer.


1 Answers

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

So check, if you have <Java SDK root>/jre/lib/ext/jfxrt.jar on your classpath under Project Structure -> SDKs -> 1.x -> Classpath? If not, that could be why. Try adding it and see if that fixes your issue, e.g. on Ubuntu, install then openjfx package with sudo apt-get install openjfx.

like image 133
Ryan J Avatar answered Oct 12 '22 20:10

Ryan J