如何将JRE与Launch4j捆绑在一起? [英] How to bundle a JRE with Launch4j?

查看:166
本文介绍了如何将JRE与Launch4j捆绑在一起?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的计算机上有Launch4J,这是一个很棒的程序。我感兴趣的一个功能是能够在一般.EXE文件中捆绑JRE。但是,我找不到任何描述如何执行此操作的文档。

I have Launch4J on my computer and it's a great program. One of its features I'm interested in is the ability to bundle a JRE in the general .EXE file. However, I can't find any documentation that describes how to go about doing this.

如何将JRE与EXE捆绑在一起?另外,我在哪里可以运行紧凑的便携式JRE? Oracle上的下载链接用于安装程序包。

How do I bundle a JRE with the EXE? Plus, where do I get a compact, portable JRE to run? The download links on Oracle are for the installer packages.

推荐答案

经过一些尝试后,我终于得到一个解决方法,将jre捆绑在我的应用程序:

After some attempts i finally get a workaround to bundle the jre in my application:

我将我的应用程序打包为zip文件,里面包含以下文件夹:

I package my app as a zip file with the following folders inside:

containerFolder
|- jre
      |-bin (in bin there is java.exe)
      |-lib
|- cfg (to save the user configuration, but it's not needed)
|- bin (my application with the .exe and the .jar and all the other stuff)

在launch4j的xml文件中我配置jre,如下所示:

In the xml file of launch4j i configure the jre like this:

<jre>
    <path>../jre</path>
    <opt>-DgvSIG.confDir=../cfg</opt>
</jre>

这里的诀窍是路径不是java.exe文件。 jre的路径是相对于.exe的位置,它应该指向java.exe文件之前的一个文件夹

The trick here is that the path is not to the java.exe file. The path to the jre is relative to the position of the .exe and it should point to one folder before the java.exe file

我正在使用的jre文件夹是只需从安装在Windows系统上的jre文件夹中复制和粘贴。

The jre folder i'm using is just a copy&paste from the jre folder installed on a windows system.

这篇关于如何将JRE与Launch4j捆绑在一起?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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