scalafx + intellij : NoClassDefFoundError: javafx/scene/shape/CullFace

823 views Asked by At

I am blocked while trying to create a javafx scala project.I created a scala project in intellij idea 13 (the ast one), then I added manuelly the jar of scalafx ("scalafx_2.10-8.0.0-M1.jar") and copied this little program :

object World extends JFXApp {
stage = new JFXApp.PrimaryStage {
    title = "Hello World"
    width = 600
    height = 450
    scene = new Scene {
        fill = Color.LIGHTGREEN
        content = Set(new Rectangle {
            x = 25
            y = 40
            width = 100
            height = 100
            //fill <== when(hover) then Color.GREEN otherwise Color.RED
        })
    }
}
}

but unfortunately I get this error message:

Exception in Application start method Exception in thread "main" java.lang.RuntimeException: Exception in Application start method at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:399) at com.sun.javafx.application.LauncherImpl.access$000(LauncherImpl.java:47) at com.sun.javafx.application.LauncherImpl$1.run(LauncherImpl.java:115) at java.lang.Thread.run(Thread.java:722) Caused by: java.lang.NoClassDefFoundError: javafx/scene/shape/CullFace at scalafx.Includes$.(Includes.scala:55)

it seems the problem is linked with javafx, which I ignored since it is normally packed with java7... can you tell me what I done wrong?

1

There are 1 answers

1
Jarek On BEST ANSWER

scalafx_2.10-8.0.0 is intended for Java 8. If you need to work with Java 7 get scalafx_2.10-1.0.0.

In Java 7, JavaFX is not in classpath by default, so you may need to add it, though IntelliJ adds it.