aspose file tools*
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


Win a copy of Soft Skills this week in the Jobs Discussion forum!
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
Author

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?

Alan

John Damien Smith
Ranch Hand

Joined: Jan 26, 2012
Posts: 157
    
    9
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 (http://jdk8.java.net/download.html), 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:
http://stackoverflow.com/questions/10888367/compiling-and-running-with-javafx-2-1

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
Alan
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: java.lang.ClassNotFoundException: javafx.embed.swing.JFXPanel Java7