scalafx/scalafx-hello-world

Error running this on Mac

windweller opened this issue · 2 comments

I was running this on mac, and I got this weird error. I have Java 8 and Scala 2.11.6.

➜  scalafx-hello-world-master  sbt run
[info] Loading project definition from /Users/Aimingnie/Desktop/ScalaSwing/scalafx-hello-world-master/project
[info] Set current project to ScalaFX Hello World (in build file:/Users/Aimingnie/Desktop/ScalaSwing/scalafx-hello-world-master/)
[info] Running hello.ScalaFXHelloWorld
[error] Exception in Application start method
[error] Exception in thread "main" java.lang.RuntimeException: Exception in Application start method
[error]     at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:875)
[error]     at com.sun.javafx.application.LauncherImpl.lambda$launchApplication$147(LauncherImpl.java:157)
[error]     at com.sun.javafx.application.LauncherImpl$$Lambda$1/423031029.run(Unknown Source)
[error]     at java.lang.Thread.run(Thread.java:745)
[error] Caused by: java.lang.NoClassDefFoundError: javafx/scene/chart/LineChart$SortingPolicy
[error]     at scalafx.Includes$.<init>(Includes.scala:58)
[error]     at scalafx.Includes$.<clinit>(Includes.scala)
[error]     at scalafx.stage.Stage.title(Stage.scala:107)
[error]     at scalafx.stage.Stage.title_$eq(Stage.scala:109)
[error]     at hello.ScalaFXHelloWorld$$anon$4.<init>(ScalaFXHelloWorld.scala:43)
[error]     at hello.ScalaFXHelloWorld$.delayedEndpoint$hello$ScalaFXHelloWorld$1(ScalaFXHelloWorld.scala:42)
[error]     at hello.ScalaFXHelloWorld$delayedInit$body.apply(ScalaFXHelloWorld.scala:40)
[error]     at scala.Function0$class.apply$mcV$sp(Function0.scala:40)
[error]     at scala.runtime.AbstractFunction0.apply$mcV$sp(AbstractFunction0.scala:12)
[error]     at scalafx.application.JFXApp$$anonfun$init$1.apply(JFXApp.scala:250)
[error]     at scalafx.application.JFXApp$$anonfun$init$1.apply(JFXApp.scala:250)
[error]     at scala.collection.immutable.List.foreach(List.scala:381)
[error]     at scala.collection.generic.TraversableForwarder$class.foreach(TraversableForwarder.scala:35)
[error]     at scala.collection.mutable.ListBuffer.foreach(ListBuffer.scala:45)
[error]     at scalafx.application.JFXApp$class.init(JFXApp.scala:250)
[error]     at hello.ScalaFXHelloWorld$.init(ScalaFXHelloWorld.scala:40)
[error]     at scalafx.application.AppHelper.start(AppHelper.scala:32)
[error]     at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$153(LauncherImpl.java:821)
[error]     at com.sun.javafx.application.LauncherImpl$$Lambda$51/1550442835.run(Unknown Source)
[error]     at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$166(PlatformImpl.java:323)
[error]     at com.sun.javafx.application.PlatformImpl$$Lambda$47/1532659705.run(Unknown Source)
[error]     at com.sun.javafx.application.PlatformImpl.lambda$null$164(PlatformImpl.java:292)
[error]     at com.sun.javafx.application.PlatformImpl$$Lambda$49/1161744034.run(Unknown Source)
[error]     at java.security.AccessController.doPrivileged(Native Method)
[error]     at com.sun.javafx.application.PlatformImpl.lambda$runLater$165(PlatformImpl.java:291)
[error]     at com.sun.javafx.application.PlatformImpl$$Lambda$48/529507459.run(Unknown Source)
[error]     at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
[error] Caused by: java.lang.ClassNotFoundException: javafx.scene.chart.LineChart$SortingPolicy
[error]     at java.net.URLClassLoader$1.run(URLClassLoader.java:372)
[error]     at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
[error]     at java.security.AccessController.doPrivileged(Native Method)
[error]     at java.net.URLClassLoader.findClass(URLClassLoader.java:360)
[error]     at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
[error]     at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
[error]     at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
[error]     ... 27 more

The issue is with incorrect version of Java 8 used to execute the example. Readme file clearly indicates that Java 8 update 40 is required.