分发 Java 应用程序的最佳方式是什么? [英] What's the best way to distribute Java applications?
问题描述
Java 是我选择的编程语言之一.尽管将我的应用程序分发给最终用户,但我总是遇到问题.
Java is one of my programming languages of choice. I always run into the problem though of distributing my application to end-users.
向用户提供 JAR 并不总是像我希望的那样用户友好,并且使用 Java WebStart 需要我维护一个 Web 服务器.
Giving a user a JAR is not always as user friendly as I would like and using Java WebStart requires that I maintain a web server.
分发 Java 应用程序的最佳方式是什么?如果 Java 应用程序需要将工件安装到用户的计算机上怎么办?有没有好的Java安装/打包系统?
What's the best way to distribute a Java application? What if the Java application needs to install artifacts to the user's computer? Are there any good Java installation/packaging systems out there?
推荐答案
根据您的分发要求,有多种解决方案.
There are a variety of solutions, depending on your distribution requirements.
就用一个罐子.这假设用户安装了正确的 java 版本,否则用户将获得类文件格式版本"异常.这适用于公司内部的内部分发.
Just use a jar. This assumes that the user has the the correct java version installed, otherwise the user will get "class-file format version" exceptions. This is fine for internal distribution inside a company.
使用launch4j和像NSIS这样的安装程序.这给了你更多的控制,尽管用户仍然可以做一些愚蠢的事情,比如卸载 java 运行时.这可能是最流行的方法,也是我目前使用的方法.
Use launch4j and an installer like NSIS. This gives you a lot more control, although the user can still do stupid stuff like un-installing the java runtime. This is probably the most popular approach, and what I currently use.
使用 Webstart.这也假设用户安装了正确的 java 版本,但它更容易上手.我的经验是,这对于严格控制的 Intranet 环境来说很好,但在较大的部署中会变得很痛苦,因为它有很多奇怪的故障.使用 Java 1.7 中的新插件技术可能会变得更好.
Use Webstart. This also assumes that the user has the correct java version installed, but it's a lot easier to get going. My experience is that this is fine for tightly controlled intranet environments, but becomes a pain with larger deployments because it has some many weird failures. It may get better with the new plug-in technology in Java 1.7.
使用像 Excelsior JET 这样的本机代码编译器并作为可执行文件分发,或将其打包在安装程序中.价格昂贵,而且通常会将您绑定到稍旧版本的 Java,并且动态类加载会带来一些麻烦,但对于需要最大程度减少支持麻烦的大规模部署来说非常有效.
Use a native-code compiler like Excelsior JET and distribute as a executable, or wrap it up in an installer. Expensive, and it generally ties you to a slightly older version of java, and there is some pain with dynamic class-loading, but its very effective for large-scale deployment where you need to minimise your support hassles.
这篇关于分发 Java 应用程序的最佳方式是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!