我一直在运行一个用Java(1.6)编写的开源项目,最近许多OSX用户报告了不支持Java 6的较新OSX的问题。我对OSX及其细微差别和特质没有真正的经验。但是我开始研究升级到Java 8的过程,并阅读到在此过程中需要用appbundler替换jarbundler,并且做到了。但是,现在我的应用程序启动,并且图标出现在任务栏中,但是没有显示任何窗口。我试图使它在启动时显示一个对话框,并且工作正常,只是我的主JFrame从不显示。另外,出现在左上角的主菜单根本不是我的菜单,它具有一些奇怪的选项,这些选项绝对不是我的。
这是bundleapp任务
<bundleapp
outputdirectory="${build.dir}"
name="DIYLC"
jvmrequired="1.8"
copyright="Branislav Stojkovic, a.k.a. bancika"
displayname="DIY Layout Creator"
identifier="org.diylc.App"
shortversion="${diylc.version}"
applicationCategory="public.app-category.graphics-design"
icon="diylc.icns"
mainclassname="${main.class}">
<classpath file="${jar.dir}\diylc.jar" />
<classpath file="${jar.dir}\lib\*.jar" />
<classpath file="${jar.dir}\library\*.jar" />
<option value="-splash:splash.png" />
<option value="-Xms512m" />
<option value="-Xmx2048m" />
<option value="-Dorg.diylc.scriptRun=true" />
<option value="-Dfile.encoding=UTF-8" />
<option value="-Dcom.apple.macos.use-file-dialog-packages=true"/>
<option value="-Dcom.apple.macos.useScreenMenuBar=true"/>
<option value="-Dapple.awt.application.name=DIY Layout Creator"/>
<option value="-Dcom.apple.smallTabs=true"/>
<option value="-Xdock:name=DIY Layout Creator"/>
<option value="-Xdock:icon=Contents/Resources/diylc.icns"/>
</bundleapp>
这是在过程中生成的Info.plist文件
<?xml version="1.0" ?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>JavaAppLauncher</string>
<key>CFBundleIconFile</key>
<string>diylc.icns</string>
<key>CFBundleIdentifier</key>
<string>org.diylc.App</string>
<key>CFBundleDisplayName</key>
<string>DIY Layout Creator</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>DIYLC</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>3.57.0</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>NSHumanReadableCopyright</key>
<string>Branislav Stojkovic, a.k.a. bancika</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.graphics-design</string>
<key>NSHighResolutionCapable</key>
<true/>
<key>NSSupportsAutomaticGraphicsSwitching</key>
<true/>
<key>JVMVersion</key>
<string>1.8</string>
<key>JVMMainClassName</key>
<string>org.diylc.DIYLCStarter</string>
<key>CFBundleDocumentTypes</key>
<array>
</array>
<key>LSArchitecturePriority</key>
<array>
</array>
<key>LSEnvironment</key>
<dict>
<key>LC_CTYPE</key>
<string>UTF-8</string>
</dict>
<key>JVMOptions</key>
<array>
<string>-splash:splash.png</string>
<string>-Xms512m</string>
<string>-Xmx2048m</string>
<string>-Dorg.diylc.scriptRun=true</string>
<string>-Dfile.encoding=UTF-8</string>
<string>-Xdock:name=DIY Layout Creator</string>
<string>-Xdock:icon=Contents/Resources/diylc.icns</string>
</array>
<key>JVMDefaultOptions</key>
<dict>
</dict>
<key>JVMArguments</key>
<array>
</array>
</dict>
</plist>
作为参考,这是可与Java 6一起使用的旧Info.plist。
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<plist version="1.0">
<dict>
<key>CFBundleName</key>
<string>DIYLC</string>
<key>CFBundleShortVersionString</key>
<string>3.57.0</string>
<key>CFBundleAllowMixedLocalizations</key>
<string>false</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleExecutable</key>
<string>JavaApplicationStub</string>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleIconFile</key>
<string>diylc.icns</string>
<key>CFBundleIdentifier</key>
<string>org.diylc</string>
<key>NSHumanReadableCopyright</key>
<string>bancika (diy-fever.com)</string>
<key>Java</key>
<dict>
<key>MainClass</key>
<string>org.diylc.DIYLCStarter</string>
<key>JVMVersion</key>
<string>1.3+</string>
<key>ClassPath</key>
<array>
<string>$JAVAROOT/diylc.jar</string>
<string>$JAVAROOT/lib\app-framework.jar</string>
<string>$JAVAROOT/lib\balloontip-1.2.4.1.jar</string>
<string>$JAVAROOT/lib\commons-compiler-3.0.6.jar</string>
<string>$JAVAROOT/lib\diylc-core.jar</string>
<string>$JAVAROOT/lib\iText-2.1.7.jar</string>
<string>$JAVAROOT/lib\janino-3.0.6.jar</string>
<string>$JAVAROOT/lib\java-http-proxy.jar</string>
<string>$JAVAROOT/lib\jep-2.4.1.jar</string>
<string>$JAVAROOT/lib\jettison-1.0.1.jar</string>
<string>$JAVAROOT/lib\junit-4.7.jar</string>
<string>$JAVAROOT/lib\log4j-1.2.15.jar</string>
<string>$JAVAROOT/lib\poi-3.5-FINAL-20090928.jar</string>
<string>$JAVAROOT/lib\swing-framework.jar</string>
<string>$JAVAROOT/lib\xstream-1.4.3.jar</string>
<string>$JAVAROOT/library\main.jar</string>
</array>
<key>VMOptions</key>
<string>splash:splash.png -Xms512m -Xmx2048m -Dorg.diylc.scriptRun=true</string>
<key>WorkingDirectory</key>
<string>$APP_PACKAGE/Contents/Resources</string>
<key>SplashFile</key>
<string>$APP_PACKAGE/Contents/Resources/splash.png</string>
<key>Properties</key>
<dict>
<key>com.apple.mrj.application.apple.menu.about.name</key>
<string>DIYLC</string>
<key>apple.laf.useScreenMenuBar</key>
<string>true</string>
</dict>
</dict>
</dict>
</plist>
就文件结构而言,旧的DIYLC.app中的Java目录是用Jars排列的,而Jars排列在几个子目录中,但是在新的DIYLC.app中,它们都没有子目录。
任何信息将不胜感激。
欢呼
更新:我发现一台装有Mojave OSX的机器,有时它工作正常,有时与Sierra上的问题相同。在Mojave无法正常工作时,我发现该窗口在窗口的左下角显示为最小化。我可以手动调整它的大小,然后就可以了。在Sierra上找不到它。