ScalaFX:HelloWorld编译错误

时间:2015-02-16 14:32:50

标签: scala javafx scalafx

我是Scala和SBT的新手,所以我可能会遗漏一些明显的东西。

我试图在http://www.scalafx.org/docs/quickstart/

上编译HelloWorld示例

我创建了一个文件build.sbt,其中包含:

scalaVersion := "2.11.5"

libraryDependencies += "org.scalafx" %% "scalafx" % "8.0.0-R4"

和包含链接页面代码的文件src/main/scala/ScalaFXHelloWorld.scala

但是,在运行sbt run时,我得到了:

OpenJDK 64-Bit Server VM warning: ignoring option MaxPermSize=256M; support was removed in 8.0
[info] Set current project to scalafx (in build file:/home/kvbx/Projects/ScalaFX/)
[info] Compiling 1 Scala source to /home/kvbx/Projects/ScalaFX/target/scala-2.11/classes...
[error] missing or invalid dependency detected while loading class file 'Color.class'.
[error] Could not access term javafx in package <root>,
[error] because it (or its dependencies) are missing. Check your build definition for
[error] missing or conflicting dependencies. (Re-run with `-Ylog-classpath` to see the problematic classpath.)
[error] A full rebuild may help if 'Color.class' was compiled against an incompatible version of <root>.
[error] missing or invalid dependency detected while loading class file 'Color.class'.
[error] Could not access term scene in value javafx,
[error] because it (or its dependencies) are missing. Check your build definition for
[error] missing or conflicting dependencies. (Re-run with `-Ylog-classpath` to see the problematic classpath.)
[error] A full rebuild may help if 'Color.class' was compiled against an incompatible version of javafx.
[error] missing or invalid dependency detected while loading class file 'Stage.class'.
[error] Could not access term javafx in package <root>,
...
...

我在Archlinux上的openjdk 1.8.0_31上运行sbt 0.13.7和scala 2.11.5

1 个答案:

答案 0 :(得分:6)

JavaFX不是OpenJDK 8的一部分。我安装了openjfx。作品。 (谢谢贾斯珀)