Two Laptop Bag
The moose likes JavaFX and the fly likes java.lang.ClassNotFoundException: javafx.embed.swing.JFXPanel Java7 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JavaFX
Bookmark "java.lang.ClassNotFoundException: javafx.embed.swing.JFXPanel Java7" Watch "java.lang.ClassNotFoundException: javafx.embed.swing.JFXPanel Java7" New topic

java.lang.ClassNotFoundException: javafx.embed.swing.JFXPanel Java7

Ally Cavs
Ranch Hand

Joined: Aug 25, 2008
Posts: 89
Hi Guys

I installed jdk1.7.0_21 and netbeans 7.3 along with scene builder. i pulled down a project in work that uses javafx and when i run it i get
java.lang.ClassNotFoundException: javafx.embed.swing.JFXPanel

Now jfxrt.jar is is the jdk1.7.0_21\jre\lib folder. So why can this file not be detected. This link states JavaFX wiki states Java FX wont be standard till java 8 but its already in Java 7 and not on the classpath? What do i do?

the pom.xml states the following. im using maven 2

if i tinker with this the IDE shows compile errors so certainly at compile time the jar can be seen. at run time no?


John Damien Smith
Ranch Hand

Joined: Jan 26, 2012
Posts: 227
Add jfxrt.jar to the classpath when using Java 7, or (preferably, but a little more complex, use the Oracle recommended JavaFX packaging tools for your development).

For Java 8 early access builds (, addition of jfxrt.jar to the classpath is not necessary as JavaFX is already on the default classpath for that Java version.

As you are using maven, you may want to use a JavaFX maven plugin, which (I believe) takes care of classpath (and other) development issues for you.
For an example of using a JavaFX maven plugin, see From Zero to JavaFX in 5 Minutes.

For an example, of command line development see:

Paste the following code and save it:

Compile and run it:
Ally Cavs
Ranch Hand

Joined: Aug 25, 2008
Posts: 89
Excellent the JavaFX maven plugin worked perfect.

Thanks alot
I agree. Here's the link:
subject: java.lang.ClassNotFoundException: javafx.embed.swing.JFXPanel Java7
It's not a secret anymore!