Compiling scalafx for Java 7u7 (that contains JavaFX 2.2) on OS X
Asked Answered
R

2

3

The compilation instructions of scalafx says to do:

export JAVAFX_HOME=/Path/To/javafx-sdk2.1.0-beta
sbt clean compile package make-pom package-src

However, with the new packaging of JavaFX as part of the Java JDK itself (i.e. 7u7 for OS X) there no longer seems to be such a 'javafx-sdkx.x.x' folder. The Oracle docs say that JavaFX JDK is placed alongside the main Java JDK (in same folders).

So I do:

$ export JAVAFX_HOME=/Library/Java/JavaVirtualMachines/jdk1.7.0_07.jdk
$ sbt clean
[warn] Using project/plugins/ (/Users/asko/Sources/scalafx/project/plugins) for plugin configuration is deprecated.
[warn] Put .sbt plugin definitions directly in project/,
[warn]   .scala plugin definitions in project/project/,
[warn]   and remove the project/plugins/ directory.
[info] Loading project definition from /Users/asko/Sources/scalafx/project/plugins/project
[info] Loading project definition from /Users/asko/Sources/scalafx/project/plugins
[error] java.lang.NullPointerException
[error] Use 'last' for the full log.
Project loading failed: (r)etry, (q)uit, (l)ast, or (i)gnore? 

Am I doing something wrong or is scalafx not yet compatible with the latest Java release (7u7, JavaFX 2.2). What can I do?

http://code.google.com/p/scalafx/

Addendum

..and finally (following Igor's solution below) sbt run launches the colorful circles demo easily (well, if one has a supported GPU that is). Oracle claims that "JavaFX supports graphic hardware acceleration on any Mac OS X system that is Lion or later" but I am inclined to think the NVidia powered Mac Mini I'm using does software rendering.

Nope, even the otherwise fast-with-javafx MacBook Air (core i7) is sluggish with the demo. Maybe it's the demo.

Rosinweed answered 16/10, 2012 at 14:33 Comment(0)
C
4

What I did was:

hg clone https://code.google.com/p/scalafx/
cd scalafx
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.7.0_07.jdk/Contents/Home
sbt clean compile package make-pom package-src

It works. It seems that the latest code checkout contains support for JavaFX bundled with the SDK. Check the build.sbt file, line 106.

Cockchafer answered 16/10, 2012 at 15:28 Comment(3)
Yes, it does. I cannot believe I didn't open 'build.sbt' myself (I still regard them as magic, I guess!) For those applying this advice, notice that it's 'JAVA_HOME' (not JAVAFX_HOME) THANKS.Rosinweed
Hey, amazing coincidence, I happen to be starting with JavaFX and facing MacOS X problems too. Is this snow leopard compatible?Eichman
I think Oracle mentions 'Lion and above' on their web page. Yes ("10.7.3" or greater). oracle.com/technetwork/java/javafx/downloads/…Rosinweed
D
0

There is also a Grade build.gradle in the ScalaFX, which I put there as an alternative build system

Diwan answered 19/10, 2012 at 8:47 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.