• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Ally Cavs
Ranch Hand
Posts: 95
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 296
14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 95
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Excellent the JavaFX maven plugin worked perfect.

Thanks alot
Alan
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic