• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Ranch Hand
Posts: 95
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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

 
Rancher
Posts: 387
30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Excellent the JavaFX maven plugin worked perfect.

Thanks alot
Alan
 
Grow your own food... or this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic