0
我有一個獨立的JavaFX應用程序使用Maven的onejar插件構建。當我運行獨立的JAR時,一切都按預期運行,但是當我使用JWrapper將.jar構建到.exe中時,我必須指定主類。這不應該需要,因爲JAR自己運行而不添加主類作爲參數。由於ClassNotFoundException(我指定的主類),目標Windows機器應用程序無法運行。Jwrapper單罐JavaFX應用程序ClassNotFoundException
這裏是我的jwrapper.xml:
<JWrapper>
<!-- The name of the app bundle -->
<BundleName>MyApp</BundleName>
<!-- The specification for one app within the bundle -->
<App>
<Name>MyApp</Name>
<MainClass>main.Main</MainClass>
<LogoPNG>AppIcon.png</LogoPNG>
</App>
<SupportedLanguages>en</SupportedLanguages>
<SplashPNG>AppIcon.png</SplashPNG>
<BundleLogoPNG>AppIcon.png</BundleLogoPNG>
<!-- 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>
<!-- The JREs JWrapper should use for Windows, Linux32, Linux64... -->
<Windows32JRE>JREs/windows-x86-jre1.8.0_60</Windows32JRE>
<Windows64JRE>JREs/windows-x64-jre1.8.0_60</Windows64JRE>
<Linux32JRE>JREs/linux-x32-jre1.8.0_60</Linux32JRE>
<Linux64JRE>JREs/linux-x64-jre1.8.0_60</Linux64JRE>
<Mac64JRE>JREs/osx-x64-jre1.8.0_60.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'>MyApp.one-jar.jar</File>
<!-- Skip OSX -->
<SkipMacOS>true</SkipMacOS>
<SkipLinux>true</SkipLinux>
</JWrapper>
如何運行與Jwrapper一個JAR?
問題是,即使我指定了Jwrapper的主類,拋出了異常。不過,我只是通過擺脫OneJar並將每個獨立的jar包裝到最終產品中來解決這個問題。我也不得不關閉Pack200的努力,以避免一些進一步的錯誤。它現在完美運行,感謝反饋。 – Ghostli