3

I have installed JDK 8 a bit ago, to use the WebView, but I got an error. The error was this:

Exception in thread "main" java.lang.NoClassDefFoundError: 
javafx/embed/swing/JFXPanel

I don't know why the Swing isn't embed into JavaFX for JDK 8, but anyone know how to fix this?

[ java -version output ]

java version "1.8.0_11" Java(TM) SE Runtime Environment (build 1.8.0_11-b12) Java HotSpot(TM) 64-Bit Server VM (build 25.11-b03, mixed mode)

Question is solved, I just needed to check in the Run Configuration that the right JRE was used.

Another question. It said the "source isn't attached" (I think the jfxrt.jar is not there where its supposed to be.) Any suggestions?

BlazingBroGamer
  • 51
  • 1
  • 1
  • 3
  • 1
    How are you running your application? From an which IDE, or command line? What is your OS? How are you packaging your application for execution? Basically all information that would help somebody help you troubleshoot the issue as there is currently not information, what you describe should "just work" and does for others. – jewelsea Aug 15 '14 at 17:31
  • I am running my application, via Eclipse, and not a Command Line. When I click run, it gives me the error in the question above, and I am using a Mac OSX. I am pretty sure all the downloads were correct, and I think that this is because of some missing source codes. I don't know which they are, but I am pretty sure thats the problem. I should have all the files from JDK 8. Thanks PS! I am using the right version and right system for this. – BlazingBroGamer Aug 15 '14 at 17:48
  • I think if you use [e(fx)clipse](http://www.eclipse.org/efxclipse/index.html), it should take care of any JavaFX path issues for you. If not, you might be able to get some further assistance in the [e(fx)clipse forums](http://www.eclipse.org/forums/index.php/f/259/). – jewelsea Aug 15 '14 at 18:23
  • Also try [compiling and running your application from the command line](http://stackoverflow.com/questions/9436219/compile-code-using-javafx-2-0-using-command-line) to make sure your issue is not an Eclipse environmental setting. – jewelsea Aug 15 '14 at 18:25
  • When you run from Eclipse, the console tab shows the location of the java executable along the top of the console. Check that and make sure it is using the JRE you think it is using. With your main application class selected, you can also go to Run -> Run Configurations, and check which JRE is selected. It is highly unlikely that some *classes* (there are no "source codes" that you downloaded with JDK8) just happen to be missing from your runtime (since they are just bundled into a couple of jar files). – James_D Aug 15 '14 at 18:42
  • @James_D Woop! Your method worked! Thanks! This question is solved – BlazingBroGamer Aug 16 '14 at 05:52

1 Answers1

7

My guess is that you think you are using Oracle Java 8, but you aren't really and are using Java 7 instead or you are using an OpenJDK Linux version which does not have JavaFX. Run java -version and edit your question to include the output.

jewelsea
  • 150,031
  • 14
  • 366
  • 406