ScalaFX: HelloWorld compilation error
Asked Answered
H

1

8

I'm new to Scala and SBT so I might be missing something obvious.

I was trying to compile the HelloWorld example on http://www.scalafx.org/docs/quickstart/

I created a file build.sbt containing:

scalaVersion := "2.11.5"

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

and a file src/main/scala/ScalaFXHelloWorld.scala containing the code from linked page.

However, when running sbt run I get:

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>,
...
...

I'm running sbt 0.13.7 and scala 2.11.5 on openjdk 1.8.0_31 on Archlinux

Hammerless answered 16/2, 2015 at 14:32 Comment(3)
Does OpenJDK 8 include JavaFX? Comments on the accepted answer of this question suggest it doesn't.Negligent
I do think so. In that document they say "For JavaFX 8 (distributed with Java 8) you will need to add dependency on ScalaFX v.8."Hammerless
Well, I think you may be right. JavaFX isn't in my distributions OpenJDK8. I'm installing openjfx from AUR now. And then I'll try again.Hammerless
H
6

JavaFX isn't part of OpenJDK 8. I installed openjfx. Works. (Thanks Jasper)

Hammerless answered 16/2, 2015 at 15:54 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.