我有一个基于JavaFX的Scala程序,可以在控制台模式和gui模式下运行.我可以在sbt中以控制台模式运行它多次.但是,如果我将它作为gui应用程序运行,那么它第一次运行.当我关闭窗口并尝试第二次运行它时,我收到以下错误消息:
> > run [info] Running Start [error] (run-main-1) java.lang.IllegalStateException: Application launch must not be called more than once java.lang.IllegalStateException: Application launch must not be called more than once at com.sun.javafx.application.LauncherImpl.launchApplication(Unknown Source) at com.sun.javafx.application.LauncherImpl.launchApplication(Unknown Source) at javafx.application.Application.launch(Unknown Source) ... etc.
该应用程序已经过测试,如果我从jar中以gui形式运行它,一切正常,所以这是sbt的一个问题.
根据fabian的评论,您必须添加
fork in run := true
to build.sbt.
有用.测试.