很长一段时间我在运行应用程序jar时遇到了问题 -
我使用Proguard
混淆JAR,并且该JAR文件还包含一些资源文件,如images,.version文件等,以及 publicCerts.store 文件。
因此,要将资源文件包含到最终JAR中,我已将所有资源文件指定为
-adaptresourcefilecontents **.fxml,**.properties,META-INF/MANIFEST.MF,images/*.jar,*.version,publicCerts.store
但是在运行我的应用程序JAR时,我得到了execption -
Exception in Application start method
java.lang.reflect.InvocationTargetException
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 com.javafx.main.Main.a(Main.java:642)
at com.javafx.main.Main.main(Main.java:805)
Caused by: java.lang.RuntimeException: Exception in Application start method
at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherIm
pl.java:403)
at com.sun.javafx.application.LauncherImpl.access$000(LauncherImpl.java:
47)
at com.sun.javafx.application.LauncherImpl$1.run(LauncherImpl.java:115)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.AssertionError: java.security.KeyStoreException: Uninitiali
zed keystore
at de.schlichtherle.license.LicenseNotary.getPublicKey(Unknown Source)
at de.schlichtherle.license.LicenseNotary.verify(Unknown Source)
at de.schlichtherle.license.LicenseManager.verify(Unknown Source)
at de.schlichtherle.license.LicenseManager.verify(Unknown Source)
at com.sun.javafx.application.LauncherImpl$5.run(LauncherImpl.java:319)
at com.sun.javafx.application.PlatformImpl$5.run(PlatformImpl.java:206)
at com.sun.javafx.application.PlatformImpl$4.run(PlatformImpl.java:173)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.access$100(WinApplication.java:29
)
at com.sun.glass.ui.win.WinApplication$3$1.run(WinApplication.java:73)
... 1 more
Caused by: java.security.KeyStoreException: Uninitialized keystore
at java.security.KeyStore.isKeyEntry(Unknown Source)
... 17 more
我认为混淆会破坏publicCerts.store,所以对publicCerts.store使用另一个混淆选项
-adaptresourcefilenames publicCerts.store
-adaptresourcefilecontents **.fxml,**.properties,META-INF/MANIFEST.MF,images/*.jar,.version
它有效。当我以前通过应用程序jar双击时,它显示我的应用程序窗口,但现在本机包可执行文件(exe)在相同的情况下以相同的情况向我显示此对话框。
已修改
I have debugged the issue and found that it's throwing exception -
java.lang.AssertionError: java.security.NoSuchAlgorithmException: PBEWithMD5AndDES SecretKeyFactory not available java.security.NoSuchAlgorithmException: PBEWithMD5AndDES SecretKeyFactory not available
我想知道本机包可执行文件(exe)是由相同的可执行文件组成的,但exe不能正常工作。下面是部署应用程序并创建本机包exe的ANT步骤。
<target name="CreatingExe" depends="SignedJar">
<fx:deploy width="800" height="600" nativeBundles="all" outdir="${dist}" outfile="${app.name}">
<fx:info title="${app.title}"/>
<fx:application name="${app.title}" mainClass="${main.class}"/>
<fx:resources>
<fx:fileset dir="${distBI}" includes="*.jar"/>
<fx:fileset dir="${WorkingFolder}/temp"/>
</fx:resources>
</fx:deploy>
</target>
仅供参考:我在Windows 8 O.S.,64位计算机上运行我的构建。我正在按照以下步骤部署我的JavaFX应用程序 -
Compiling JavaFX Code.
Creating JAR.
Obfuscating code.
Signing Jar
Creating Executable.
Signing Executable.
Build was successful.
如何从混淆中排除publicCerts.store?为什么即使应用程序jar工作,最终的exe也不起作用?我是否需要在fx:deploy task中指定其他任何东西?
答案 0 :(得分:0)
构建JavaFx本机包时,ext
下的<JDK.HOME>
文件夹不会包含在内。该文件夹包含的内容主要是安全性。
<!--Copy the ext library to the runtime lib-->
<copydir src="${java.home}/lib/ext"
dest="${dist.jar.dir}/bundles/{YOUR.PACKAGE.NAME}/runtime/jre/lib/ext"
includes="**/*"
/>