简体   繁体   English

在OS X上为Java 7u7(包含JavaFX 2.2)编译scalafx

[英]Compiling scalafx for Java 7u7 (that contains JavaFX 2.2) on OS X

The compilation instructions of scalafx says to do: scalafx的编译说明如下

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 (ie 7u7 for OS X) there no longer seems to be such a 'javafx-sdkx.xx' folder. 然而,随着JavaFX的新包装作为Java JDK本身的一部分(即OS X的7u7),似乎不再有这样的'javafx-sdkx.xx'文件夹。 The Oracle docs say that JavaFX JDK is placed alongside the main Java JDK (in same folders). Oracle文档说JavaFX JDK与主Java JDK(在相同的文件夹中)一起放置。

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). 我做错了什么或scalafx还不兼容最新的Java版本(7u7,JavaFX 2.2)。 What can I do? 我能做什么?

http://code.google.com/p/scalafx/ 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). ..最后(按照下面的Igor的解决方案) sbt run轻松启动彩色圆圈演示(好吧,如果有一个支持的GPU)。 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. Oracle 声称 “JavaFX支持Lion或更高版本的任何Mac OS X系统上的图形硬件加速”,但我倾向于认为我使用的NVidia驱动的Mac Mini是软件渲染。

Nope, even the otherwise fast-with-javafx MacBook Air (core i7) is sluggish with the demo. 不管怎么说,即使是快速使用javafx的MacBook Air(核心i7)也不会随着演示而变得迟钝。 Maybe it's the demo. 也许这是演示。

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. 似乎最新的代码检出包含对与SDK捆绑在一起的JavaFX的支持。 Check the build.sbt file, line 106. 检查build.sbt文件,第106行。

ScalaFX中还有一个Grade build.gradle ,我将其作为替代构建系统放在那里

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM