是否有机会获得-splash:< image>是否适用于需要-XstartOnFirstThread的SWT应用程序? [英] Is there a chance to get -splash:<image> work for SWT applications that require -XstartOnFirstThread?
问题描述
我正在使用以下命令启动Scala SWT应用程序:
I am launching my Scala SWT application using:
java -splash:splash.jpg -jar application.jar
在Mac OS X 10.9.1上使用JDK 1.6.0时,启动屏幕会立即打开(在打开实际应用程序窗口之前几秒钟).
Using JDK 1.6.0 on Mac OS X 10.9.1 the splash screen was opened immediately (seconds before the actual application window opened).
当SWT应用程序窗口打开时,我使用以下代码关闭了初始屏幕:
I used the following code to close the splash screen when the SWT application window opened:
// When the window opens for the first time close the splash screen if exists
val splash = SplashScreen.getSplashScreen
if (splash != null) {
shell.addShellListener(new ShellAdapter {
override def shellActivated(event: ShellEvent) {
shell.removeShellListener(this)
splash.close
}
})
}
行为符合预期: 当应用程序准备就绪时,我得到了一个很早的启动屏幕.
The behavior was as intended: I got a very early splash screen that was closed when the application was ready.
现在,在JDK 1.7.0_45上,在打开应用程序窗口并在splash.close
处冻结应用程序时,启动屏幕已打开.
Now on JDK 1.7.0_45 the splash screen is opened the moment the application window was opened and the application freezes at splash.close
.
我阅读了 https://www.java.net//node/668622 从Java 6到Java 7对SplashScreen
API进行了一些更改,但这并不能解释完全不同的行为.
I read https://www.java.net//node/668622 that some changes were made to the SplashScreen
API from Java 6 to Java 7 but that doesn't explain the totally different behavior.
在SWT应用程序的Java 7上运行JVM初始屏幕是否有变化?
Is there a change getting the JVM splash screen run on Java 7 for a SWT application?
仅供参考:我正在使用普通的SWT,但周围没有Eclipse(包括支持启动屏幕的Eclipse启动器).
FYI: I am using plain SWT without Eclipse (that includes the Eclipse launcher that supports splash screens) around it.
推荐答案
在JDK9或更高版本中也许会有解决方案.目前,在OS X Yosemite上使用JDK8时,此问题没有任何改善.
Maybe there will be a solution for this in JDK9 or later. At the moment with JDK8 on OS X Yosemite there is no improvement on this problem.
此刻,我将使用此摘录中的代码 rel ="nofollow">有.他们两个都在工作.
At the moment I'll use code from this snippet here or this one there. Both of them are working.
希望该错误将在JDK9中关闭!
Hopefully the bug will be closed in JDK9!
这篇关于是否有机会获得-splash:< image>是否适用于需要-XstartOnFirstThread的SWT应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!