如何使用特定的JRE交付我的Java应用程序? [英] How to deliver my Java application with a particular JRE?

查看:123
本文介绍了如何使用特定的JRE交付我的Java应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人知道如何将特定JRE与已编译的Java应用程序一起打包吗?我目前有一个可执行的jar文件,并希望将JRE 6 Update 31放入其中。因此,无论客户端安装了哪个JRE版本,应用程序都会使用随附的JRE。解决方案应该独立于平台。

Does somebody know how to pack a particular JRE together with a compiled Java application? I currently have an executable jar file and wish to put JRE 6 Update 31 in it. So that the application uses the shipped JRE regardless of which JRE version the client has installed. The solution should work platform independent.

任何想法?非常感谢提前!

Any ideas? Many thanks in advance!

推荐答案

在OSX上,他们正在从提供Java的Apple转向提供Java的Oracle,这也意味着在全新安装的OSX上不会安装Java。 Oracle提供了一个用于打包Java安装的工具,他们强烈建议在安装过程中提供jre。这样做的好处是客户不必安装额外的软件包来运行您的应用程序,您可以针对正确的Java运行时测试您的应用程序,并确保在发货之前没有不兼容性。令人遗憾的是,构建安装程序要复杂得多,下载量也要大一些。

On OSX, they are moving away from Apple providing Java to Oracle providing Java, this also means that Java will not be installed on a fresh install of OSX. Oracle have provided a tool for packing up Java installations and they strongly recommend providing a jre as part of your installation. The advantage of this is that the customer will not have to install an additional package in order to run your application, and you can test your application against the correct Java runtime for you and ensure there are no incomptabilities before shipping. The disavantage is that building the installer is slighty more complex and your download size is larger.

当然,如果要为Windows提供应用程序,构建安装程序会变得更复杂, Linux ectera,只提供一个可执行的jar会更简单,但这不是客户想要的体验。客户不希望能够下载一个应用程序并在Windows,osx和linux上运行相同的exe。他们很高兴为每个平台安装不同的安装程序,并期望安装人员以不同的方式工作。

Of course building installers get more complex if you want to provide your applications for Windows, Linux ectera and it would be alot simpler to just provide an executable jar but this is not the experience customers want. Customers do not expect to be able to download one application and run the same exe on windows, osx and linux. They are happy
to have different installers for each platform and also expect the installers to work in a different way.

这就是我的工作方式:

OSX:将AppBundler与捆绑的jre一起使用,放入带有DMGCanvas的Dmg。用户只需将应用程序拖动到他们的/ Application文件夹。

OSX:Use AppBundler with bundled jre, put onto a Dmg with DMGCanvas. The user simply drags the application to their /Application folder.

Windows:使用带有launch4j包装的捆绑jre的Izpack,这样安装程序就可以作为exe运行。

Windows:Use Izpack with bundled jre wrapped with launch4j so installer can be run as an exe.

Linux:使用没有捆绑jre的Izpack,因为用户linux用户喜欢控制他们机器上的确切内容,但是指定允许的最小Java版本。理想情况下,我应该为主要的Linux软件包管理器创建软件包,例如rpm,但我认为目前这不值得,因为Linux用户占我的客户群的一小部分。

Linux:Use Izpack without bundled jre, as user linux users like to be in control of exactly what on their machine, but specify minimum version of Java allowed. Ideally I should create packages for the main Linux Package Managers such as rpm but Ive decided this is not worth the effort at the moment as Linux users are a small percentage of my client base.

大多数安装都是使用Maven和Ant自动完成的,因此构建这些不同的安装程序并不是一件大事。

Most of the installation is automated using Maven and Ant, so its not a big effort to build these different installers.

这篇关于如何使用特定的JRE交付我的Java应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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