在对所有以前的帖子(在本网站和其他地方)进行了大量研究之后,我在此处发布关于在 Mac OSX 10.10 的 VMWare 封装实例中运行 JavaFX 应用程序(使用 JWrapper 作为启动器开发)的问题。[注意:在 2015 年 2 月 25 日编辑了前一句和这篇帖子的标题,以添加对 VMWare 的引用。]
在我的更大的 Java 1.8.0_25 应用程序在 Mac OSX v10.10.1 中安装和启动失败后,我使用 3 行“Hello World”JavaFX 应用程序复制了这个问题。
在这两种情况下,我都在 JWrapper build-parm XML 中使用似乎是标准的面向 Mac 的参数设置:
<JvmOption>-Djavafx.macosx.embedded=true</JvmOption>
<MustFork>true</MustFork>
在这两种情况下,当尝试在 Mac 上安装时,JWrapper 初始屏幕会按预期显示,但随后消失,并且应用程序本身无法启动。
以下是 (1) zip 文件的链接,其中包含来自 Mac OSX v10.10.1 上尝试安装的“HelloWorldFX”的所有日志,以及 (2) 包含应用程序 JWrapper 构建过程中的日志和“build”文件夹的 zip 文件。请注意,此应用程序可以在 Windows 和 Ubuntu 中正常安装和运行。
日志: https ://googledrive.com/host/0B0skoeyva4KiUDZBS1FSUXo4RUU/mac_logs.zip
构建文件夹(300MB): https ://googledrive.com/host/0B0skoeyva4KiUDZBS1FSUXo4RUU/helloWorldFX_build_folder.zip
以下是重点:
HelloWorldFX 代码(几乎是整个应用程序):
public void start(Stage stage) {
stage.setTitle("Hello World FX");
stage.setScene
(new Scene(new StackPane(new Button("Hello World FX")), 600, 250));
stage.show();
}
我完整的 JWrapper 构建参数:
<JWrapper>
<!-- The name of the app bundle -->
<BundleName>HelloWorldFX3</BundleName>
<!-- The specification for one app within the bundle -->
<App>
<Name>HelloWorldFX3</Name>
<LogoPNG>images/logo.png</LogoPNG>
<MainClass>helloworldfx.HelloWorldFX</MainClass>
</App>
<SupportedLanguages>en</SupportedLanguages>
<!-- App is a per-user app, it won't elevate and install for all users and the shared config folder will be per-user -->
<InstallType>CurrentUser</InstallType>
<!-- No <UpdateURL> element included here: only interested in **offline** installation -->
<!-- Splash and Logo -->
<SplashPNG>images/splash.png</SplashPNG>
<BundleLogoPNG>images/logo.png</BundleLogoPNG>
<!-- JVM options (e.g. extra memory) -->
<JvmOptions>
<JvmOption>-Xmx256m</JvmOption>
<!-- following Mac-related option IS used in this build: for info, see: http://www.jwrapper.com/old-forum.html#nabble-td409 -->
<JvmOption>-Djavafx.macosx.embedded=true</JvmOption>
</JvmOptions>
<!-- The JREs JWrapper should use for Windows, Linux32, Linux64... -->
<Windows32JRE>jrepack18/win32/jre1.8.0_25</Windows32JRE>
<Windows64JRE>jrepack18/win32/jre1.8.0_25</Windows64JRE>
<Linux32JRE>jrepack18/linux/jre1.8.0_25</Linux32JRE>
<Linux64JRE>jrepack18/linuxx64/jre1.8.0_25</Linux64JRE>
<Mac64JRE>jrepack18/macos64/jre1.8.0_25.jre</Mac64JRE>
<!-- The files that the app wants to bundle, here we have just one which is a JAR file and we specify that it should be on the launch classpath -->
<File classpath='yes'>helloWorldApp/HelloWorldFX.jar</File>
<!-- NoStripJREs option required to avoiding stripping out of JavaFX classes! For info, see: http://www.jwrapper.com/old-forum.html#nabble-td89 -->
<NoStripJREs>true</NoStripJREs>
<!-- This Mac-related option IS used in this build: -->
<MustFork>true</MustFork>
</JWrapper>
来自 Mac 上“Wrapper”日志文件的不祥消息:
+1 [BundleLoader] Could not load JRE bundle!
Mac 上“通用更新程序”日志文件中的一条奇怪的行,其中文件名显然被 JWrapper 截断,导致找不到文件异常:
8574158 (+0) java.io.FileNotFoundException: /Users/admin/Library/Application Support/JWrapper-HelloWorldFX3/JWrapper-JWrapper-00033253833-complete/JWAppSpec- (No such file or directory)
Mac 上的整个“HelloWorldFX”日志文件(只是在尝试禁用 App Nap 之后或期间出现):
8574542 (+0) STDOUT test
8574542 (+0) STDERR test
8574543 (+1) [LogFolderCleaner] Keeping Wrapper-2015-02-18-23-56-04-443.log
8574543 (+0) [LogFolderCleaner] Keeping HelloWorldFX3-HelloWorldFX3-2015-02-18-23-56-14-525.log
8574544 (+1) [LogFolderCleaner] Keeping GenericUpdater-2015-02-18-23-56-13-488.log
8574545 (+1) [EDT Exception Printer] Catching all EDT and uncaught exceptions and printing
8574548 (+3) [JWrapperNative] Detected 64-bit architecture
8574548 (+0) [JWrapperNative] Detected Mac OS
8574551 (+3) [JWrapper] sun.java2d.dpiaware: null
8574558 (+7) [JWDetectedProxy] No proxy configuration found to load.
8574559 (+1) JVM Option: -Xmx256m
8574559 (+0) JVM Option: -Djavafx.macosx.embedded=true
8574559 (+0) [JWrapper] JVM Home: /Users/admin/Library/Application Support/JWrapper-HelloWorldFX3/JWrapper-Mac64JRE-00034082796-complete
8574573 (+14) [JWrapper] Wrote JVM Options OK
8574574 (+1) [JWrapper] Set app name to HelloWorldFX3
8574577 (+3) [JWrapper] Loading virtual app
8574577 (+0) [JWrapper] Got virtual app HelloWorldFX3
8574577 (+0) [JWrapper] Setting OS dock info
8574786 (+209) [JWrapper] Image: BufferedImage@5ef04b5: type = 6 ColorModel: #pixelBits = 32 numComponents = 4 color space = java.awt.color.ICC_ColorSpace@5f4da5c3 transparency = 3 has alpha = true isAlphaPre = false ByteInterleavedRaster: width = 256 height = 245 #numDataElements 4 dataOff[0] = 3
8574887 (+101) [JWrapper] Disabling App Nap
任何有关解决此问题的帮助将不胜感激!!