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

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

问题描述

我的电脑上有 Launch4J,这是一个很棒的程序.我感兴趣的其中一项功能是能够将 JRE 捆绑到通用 .EXE 文件中.但是,我找不到任何描述如何执行此操作的文档.

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天全站免登陆