JavaFX .exe文件由于主类中的异常而失败 [英] JavaFX .exe file Failed due to exception in main class

查看:438
本文介绍了JavaFX .exe文件由于主类中的异常而失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开发了一个JavaFX应用程序,并使用本机打包工具(包括Inno Setup 5和WiX)来创建.exe文件和安装程序。该程序是一个自包含的应用程序,意味着它有自己的JRE和/ lib文件夹中的一些外部.jars。当我安装并执行它,它在我自己的电脑(Windows 7)和其他一些机器上运行正常,但似乎不能在Windows 10和Windows Server 2008 R2上运行。还有一些Windows 7机器无法执行。单击启动图标后的错误消息为:由于主类中的异常导致失败。它不多说但是当我通过双击或通过命令提示符执行jar文件时,它将在命令行中没有任何错误转储启动,一切正常。



任何想法错误是?我怀疑课程的路径,但我不知道肯定。



谢谢!



p>

Alex

解决方案

发现自己:问题是我添加的VM参数在fx:platform / fx:jvmarg部分的build.xml中。这些参数被放入从.exe文件调用的package.cfg文件中,以初始化VM。



显然,我用于安装该工具的某些操作系统没有正确的Java设置(这不是关于类路径设置,我也预先检查过),所以VM可以在实例化工具之前崩溃,因此我的自定义错误记录器。



在删除引起VM参数的错误(调试参数,安全管理器和策略文件的位置)后,它在所有Windows平台上运行(7/8/10)因为它应该。


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

解决方案

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.

这篇关于JavaFX .exe文件由于主类中的异常而失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆