Bundle a JRE into an exe using Launch4J

╄→尐↘猪︶ㄣ 提交于 2019-11-30 15:08:16

With launch4j it's not possible to put the JRE inside an exe. The 'bundle' option of launch4j simply means that you distribute your exe together with a JRE, so alongside it. You can do this by adding the following option to your config xml file.

<jre>
    <path>.....</path> 
</jre>

It's important that you specify the path to the JRE relative to your executable, otherwise it won't work if you move the exe to another location (or to another computer). The error message you got is because you didn't move or copy the JRE together with your exe, so the executable can't find the JRE anymore.

Alternatively if you don't use the bundle option, launch4j will try to use a system JRE and if it cannot find one redirect users to the Oracle JRE download page. If this is not what you want, and you really want a single exe for distribution then your only other option is to use an installer like NSIS or Inno Setup.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!