将JRE与Java应用程序捆绑在一起 [英] Bundling the JRE with a Java application
问题描述
我创建了一个带有launch4j Ant脚本和build.xml文件的exe。我想将JRE捆绑在我的应用程序中,并且必须将其分发给客户端。我该怎么做?
I have created an exe with a launch4j Ant script and build.xml file. I want to bundle the JRE in my application and have to distribute it to clients. How do I do this?
谢谢,
拉贾尼
Thanks, Rajani
推荐答案
好吧,只需将 $ JAVA_HOME / jre
下的所有内容捆绑到您的发行版中(大概是 Zip
/ TAR
文件),然后让您的脚本引用该文件(即使用 $ JRE_HOME / bin下的
运行Java程序。) java
可执行文件
Well, just bundle everything under $JAVA_HOME/jre
into your distribution (presumably a Zip
/TAR
file) and then have your scripts reference that (i.e. use the java
executable under $JRE_HOME/bin
to run your java program).
请记住,如果执行此操作,则必须为不同的目标平台(Windows, OSX,Linux等)和体系结构(当然是一个过大的 uber-distribution ,但没人会为此感谢您!)。
Remember that if you do this, you will have to deliver different distributions for different target platforms (Windows,OSX, linux etc) and architectures (or one bloated uber-distribution of course, but no one will thank you for that!).
这篇关于将JRE与Java应用程序捆绑在一起的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!