-->

JavaFX .exe file Failed due to exception in main c

2020-05-09 09:39发布

问题:

I developed an JavaFX application and used the native packaging tool (incl. Inno Setup 5 and WiX) to create .exe files and installers. The program is a self-containing application, means it has its own JRE on board and some external .jars in a /lib folder. When I install and execute it it runs fine on my own computer (Windows 7) and some other machines but it seems not to run on Windows 10 and Windows Server 2008 R2. Also some Windows 7 machines cannot execute it. The error message after clicking the launch icon is: "Failed due to exception in main class". It does not say more. But when I execute the jar file by double-clicking or via the command prompt, it starts without any error dumps in the command line, all works fine.

Any idea what the error is? I suspect the class path but I dont know for sure.

Thank you!

Best regards,

Alex

回答1:

Found out myself: the issue were VM parameters I added in the build.xml in the fx:platform / fx:jvmarg section. These params were put into the package.cfg file which is called from the .exe file to initialize the VM.

Obviously some of the operating systems I used to install the tool did not have the correct Java setup (it is not about classpath settings, I checked that beforehand too) so the VM crashed before being able to instantiate the tool and therefore my custom error logger.

After removing the error causing VM params (parameters for debugging, security manager and the location of the policy file) it worked on all Windows platforms (7/8/10) as it should.