在不同操作系统上发布java应用程序

发布于 2024-08-01 22:27:35 字数 239 浏览 2 评论 0原文

我有一个java应用程序,我想将其发布为exe或dwg等,以便不同平台上的用户可以双击它并开始运行。 但是为了让我的代码能够很好地工作,我需要它作为 Windows 服务以及其他操作系统中的等效项工作。 使用 Java Web Start 不是一个解决方案,因为据我了解,如果客户端计算机关闭,则用户将不得不再次双击 exe。 我尝试过 java 服务包装器,但我不知道如何使其可发布。

谢谢 普拉纳贝什

I have a java application that I want to release as an exe or dwg etc so that users on different platforms can double click it and get it to start running.
But for my code to work really well I need it to work as a windows service and whatever the equivalent of this in other OS are.
Using Java web start is not a solution because as I understand it, if the client machine shuts down then the user will have to again double click on the exe.
I have tried java service wrapper but I can't see how to make it releasable.

Thanks
Pranabesh

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

巷子口的你 2024-08-08 22:27:35

您需要为要发布的每个操作系统构建一个发布包。

例如,对于 Windows,您需要找到一个可执行包装器。 我已经有一段时间没有这样做了,但我记得使用了一些实际上会构建安装程序作为过程的一部分的文件。

Launch4j是我刚刚想起的一个

You would need to build a release package for each operating system you were to release on.

For Windows, for example, you will need to find an executable wrapper. It's been a while since I've done this, but I remember usign a couple that would actually build an installer as part of the proccess.

Launch4j is one I've just remembered

瑶笙 2024-08-08 22:27:35

如果您可以接受商业工具,我建议您 install4j 。 它可以为最常见的平台生成安装程序,专门支持将应用程序安装为服务。

引自他们的功能页面

install4j 提供对生成和安装服务(守护进程)的全面支持。 对于服务,install4j 在 Windows 上生成服务可执行文件,在 Mac OS X 上生成启动项,在 Unix/Linux 平台上生成启动/停止脚本。

If a commercial tool is acceptable for you, I'd recommend install4j. It can produce installers for the most common plaftforms, which specifically support installing the application as a service.

Quote from their Features page:

install4j offers full support for generating and installing services (daemons). For services, install4j generates service executables on Windows, startup items on Mac OS X and start/stop scripts on Unix/Linux platforms.

旧城烟雨 2024-08-08 22:27:35

Java Service Wrapper 是适用于 Windows/Unix/OSX 的一种方法。 我已经使用它好几年了,没有任何问题。 它是一个很棒的软件,可以很好地处理 JVM 崩溃/挂起,并在发生问题时自动重新启动服务。

关于应用程序的分发,我建议在 Windows 上使用 NSIS。 它可以创建一个不错的安装程序,将文件放在必要的位置,并运行 JSW 存根以在目标系统上安装服务。 对于 Unix,您可以将其打包在 tar.gz 中,并提供有关如何安装该服务的说明(将 sh 脚本复制到 /etc/init.d 中,使用 chkconfig 或任何其他用于管理启动脚本的系统相关工具来安装它)。 在 Mac 上,您应该将其打包到 dmg 中。

如果您想要更跨平台的解决方案,您也可以尝试 izpack。 izpack 可以从 java web start 运行,作为本机 Windows 应用程序或 Mac 应用程序,请检查 实用程序页面

IzPack 是打包、分发和部署应用程序的一站式解决方案。
它是完全跨平台的,并生成单个安装程序。 因此,它是本机解决方案(例如特定于平台的安装程序和包管理器)的替代方案。
IzPack 生成的安装程序仅需要 Java 虚拟机即可运行。

Java Service Wrapper is a way to go for Windows/Unix/OSX. I've been using it with no problems for some years. It's a great software and handles JVM crashes/hangs well automatically restarting the service if something bad happens.

What concerns the distribution of the application, I'd recommend NSIS on Windows. It can create a nice installer that will put the files where necessary and run the JSW stub to install the service on the target system. For Unix you can just package it in tar.gz and provide instructions on how to install the service (copy the sh script into /etc/init.d, install it using chkconfig or any other system dependent tool for managing startup scripts). On Mac you should package it into dmg.

You may also try izpack if you want a more cross-platform solution. izpack can run from the java web start, as a native windows application or mac application, check the utilities page.

IzPack is a one-stop solution for packaging, distributing and deploying applications.
It is fully cross-platform and generates a single installer. As such, it is an alternative to native solutions such as platform-specific installers and package managers.
IzPack-generated installers only require a Java virtual machine to run.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文