當試圖運行從sbt 0.10.1編寫的Scala 2.8.1中的簡單JavaFX 2.0 beta應用程序時,應用程序窗口關閉後會拋出異常:從sbt運行JavaFx 2.0 beta應用程序時引發InterruptedException 0.10.1
> run
[info] Running com.tradex.priceviewer.Main
Exception while removing reference: java.lang.InterruptedException
java.lang.InterruptedException
[ at java.lang.Object.wait(Native Method)success
] at java.lang.ref.ReferenceQueue.remove(Unknown Source)Total time: 5 s, completed Aug 5, 2011 1:12:04 PM
at java.lang.ref.ReferenceQueue.remove(Unknown Source)
at com.sun.glass.utils.Disposer.run(Disposer.java:64)>
at java.lang.Thread.run(Unknown Source)
當運行在命令行不會拋出異常和返回的狀態的應用程序是0的應用程序的代碼在下面給出:引發異常
class Starter extends Application {
def main(args: Array[String]) {
Application.launch(args)
}
override def start(s: Stage) {
s.setVisible(true)
}
}
object Main {
def main(args: Array[String]) {
val gui = new Starter
gui.main(args)
}
}
後一個具有退出並再次啓動sbt(重新加載不起作用)。
scala> m.main(Array(""))
scala> m.main(Array(""))
java.lang.IllegalStateException: Application launch must not be called more than once
at com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:41)
at javafx.application.Application.launch(Application.java:115)
at com.tradex.priceviewer.Starter.main(Main.scala:19)
at .<init>(<console>:11)
at .<clinit>(<console>)
at RequestResult$.<init>(<console>:9)
at RequestResult$.<clinit>(<console>)
at RequestResult$scala_repl_result(<console>)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at scala.tools.nsc.Interpreter$Request$$anonfun$loadAndRun$1$$anonfun$apply$17.appl...
scala>
會有人有任何線索如何正確地退出此斯卡拉/ JavaFX應用程序(所以人們不會需要:當運行從斯卡拉同一個應用程序2.8.1控制檯下面的例外是第二次運行後拋出重新啓動sbt或scala控制檯)?
謝謝!這工作非常好。 – Stas