アプリケーションjarの実行中に長い間問題に直面していました-
JAR を使用して難読化しています。その JAR ファイルには、 publicCerts.storeProguard
ファイルとともに、画像、.version ファイルなどのリソース ファイルも含まれています。
したがって、リソース ファイルを最終的な 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 OS、64 ビット マシンでビルドを実行しています。次の手順でJavaFXアプリケーションをデプロイしています-
Compiling JavaFX Code.
Creating JAR.
Obfuscating code.
Signing Jar
Creating Executable.
Signing Executable.
Build was successful.
publicCerts.store を難読化から除外するには? アプリケーションjarが機能していても、最終的なexeが機能しないのはなぜですか? fx:deploy タスクで他に何か指定する必要はありますか?