我用Launch4j创建的.exe不运行

时间:2020-12-10 13:16:23

I was able to successfully create a .exe file from an executable jar. From Launch4j I can test the wrapper, and the output on the log is what I expect. However if I try to run the exe from the command line or from Windows Explorer, nothing happens. No error, no output to the console as expected. The program is also supposed to edit a text file which does happen when I run the jar using a batch file, but not when I run the exe. This is all on the same computer so I doubt it is a problem with the JRE. I have searched * extensively but found nothing that helps with this situation. I did find this post with a similar problem: Launch4J executable not executing as expected but nobody actually answered the question. Thank you in advance for helping

我能够从可执行jar中成功创建.exe文件。从Launch4j我可以测试包装器,日志上的输出是我所期望的。但是,如果我尝试从命令行或Windows资源管理器运行exe,则不会发生任何事情。没有错误,没有按预期输出到控制台。该程序也应该编辑一个文本文件,当我使用批处理文件运行jar时会发生这种情况,但是当我运行exe时却不会。这都是在同一台计算机上,所以我怀疑它是JRE的一个问题。我已经广泛搜索了*,但没有发现任何有助于这种情况。我确实发现这个帖子有类似的问题:Launch4J可执行文件没有按预期执行但没有人真正回答了这个问题。提前感谢您的帮助

2 个解决方案

#1


4  

I found the issue. Under Header, I had to switch the Header type from GUI to Console. After that I was able to run the exe.

我发现了这个问题。在Header下,我不得不将Header类型从GUI切换到Console。之后,我能够运行exe。

#2


1  

You may be accepting something as a command line argument which may be throwing an error like in my case .

您可能会接受某些命令行参数,这可能会像我的情况一样抛出错误。

#1


4  

I found the issue. Under Header, I had to switch the Header type from GUI to Console. After that I was able to run the exe.

我发现了这个问题。在Header下,我不得不将Header类型从GUI切换到Console。之后,我能够运行exe。

#2


1  

You may be accepting something as a command line argument which may be throwing an error like in my case .

您可能会接受某些命令行参数,这可能会像我的情况一样抛出错误。