java 如何在 Launch4j 中使用 Bundle JRE 选项
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/15412530/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How do I use the Bundle JRE option in Launch4j
提问by Umdoobby
I have worked with Java for a while now, long enough to start producing my own programs with GUIs and not just little sample programs from a text book that run in Eclipse. I wanted to make my programs more user friendly for the user, specifically the Windows users, by wrapping the executable Jar into an Exe. So I found Launch4j, it seems to do a pretty good job but I have no idea what over half of the options in that program mean (It took me an hour to figure out how to get it to make a functional Exe). I handed that to a fried to test and he returned to me saying that he was getting the no JRE found error. Well I wondered how I can force the end users to have the JRE then I noticed the bundle JRE option in Launch4j. But how do I use it? Do I download the JRE offline installer for Windows and it will run that if it can't find an installed one? Then what about proper version for the system (32-bit v 64-bit). I guess I was thinking I would lead it to this mysterious package containing a JRE and my wrapped program would use that to run. Just can someone please tell me how to use that function, what if anything I have to download, etc.
我已经使用 Java 工作了一段时间,时间已经足够开始使用 GUI 生成我自己的程序,而不仅仅是在 Eclipse 中运行的教科书中的小示例程序。我想让我的程序对用户更友好,特别是 Windows 用户,通过将可执行 Jar 包装到一个 Exe 中。所以我找到了 Launch4j,它似乎做得很好,但我不知道该程序中超过一半的选项是什么意思(我花了一个小时才弄清楚如何让它成为一个功能性的 Exe)。我把它交给了一个油炸的测试,他回到我身边说他得到了没有发现 JRE 的错误。好吧,我想知道如何强制最终用户拥有 JRE,然后我注意到 Launch4j 中的捆绑 JRE 选项。但是我该如何使用它呢?我是否下载了适用于 Windows 的 JRE 离线安装程序,如果可以,它会运行它吗?没有找到已安装的?那么系统的正确版本(32 位 v 64 位)呢?我想我在想我会把它引向这个包含 JRE 的神秘包,我的包装程序将使用它来运行。有人可以告诉我如何使用该功能,如果我必须下载任何东西,等等。
If Launch4j isn't the best program to do this then please recommend something else, I have only just started to get into this, for all I know there is a better wrapper out there.
如果 Launch4j 不是执行此操作的最佳程序,那么请推荐其他程序,我才刚刚开始研究这个,因为我知道那里有更好的包装器。
采纳答案by Jean Waghetti
Your "installation" will need an already installed JRE (with jre/bin
folder with java.exe
and all the other files) for a "bundled" JRE. You can't pack an Java installer with launch4j.
您的“安装”将需要一个已安装的 JRE(带有jre/bin
文件夹java.exe
和所有其他文件)用于“捆绑”JRE。您不能使用 launch4j 打包 Java 安装程序。
Doesn't it show to your friend the option to download and install Java if it doesn't find a JRE?
如果找不到 JRE,它不会向您的朋友显示下载和安装 Java 的选项吗?
If you want to install Java alongside with your application, take a look at NSIS.
如果您想将 Java 与您的应用程序一起安装,请查看NSIS。
There's another one: IzPack. It creates multi-plataform installer. But, as it depends on Java, it's the same case of launch4j -> you'll need to download and install Java first. (I didn't use IzPack yet, but when I was looking for a solution, it was one of my alternatives.)
还有另一个:IzPack。它创建了多平台安装程序。但是,由于它依赖于 Java,因此与 launch4j 的情况相同 -> 您需要先下载并安装 Java。(我还没有使用 IzPack,但是当我在寻找解决方案时,它是我的替代方案之一。)
回答by ed22
I have created my own version of the launch4j that allows downloading and installing of required JRE automatically. If you want to give it a try, get it here: https://github.com/maztan/launch4j_auto_jre_download. After running the launch4j, set the options in the "JRE" tab.
我创建了自己的launch4j 版本,允许自动下载和安装所需的JRE。如果您想尝试一下,请在此处获取:https: //github.com/maztan/launch4j_auto_jre_download。运行launch4j后,在“JRE”选项卡中设置选项。