分发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屋!