更新时间:2023-02-21 23:34:27
如果使用 jpackage --win-console
参数激活控制台,则可以更容易地诊断jpackage生成的EXE问题.
Problems with the EXE generated by jpackage can be easier to diagnose if you activate the console with jpackage --win-console
parameter.
您可能不想对主应用程序EXE执行此操作,因此可以使用第二个启动器来分发您的应用程序,该启动器启用了控制台并且具有相同的主类.只需创建一个新文件 appwithconsole.properties
并使用:
You might not want to do this for the main app EXE, so instead you could distribute your application with a second launcher which has the console enabled and same main-class. Just create a new file appwithconsole.properties
and use:
jpackage --add-launcher debugversion=appwithconsole.properties ... rest of command line.
appwithconsole.properties
main-class=as.used.in.command.line
win-console=true
然后在删除jar后尝试 debugversion.exe
,它应该比没有控制台的EXE更清楚地报告错误:
Then try debugversion.exe
after deleting the jar, it should report the error more clearly than the EXE without console:
Error: Could not find or load main class ...