无需安装即可为不同平台创建独立的Java可执行文件 [英] Create standalone Java executable for different platforms without installation

查看:81
本文介绍了无需安装即可为不同平台创建独立的Java可执行文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用jlink创建了Java应用程序运行时映像.我希望能够将该软件作为可执行文件发布到不同的平台.(最好是在一个平台上构建,例如交叉编译.)

I have created a Java application runtime image using jlink. I would like to be able to ship the software as an executable to different platforms. (Preferably by building on one platform, like cross-compiling.)

理想情况下,这将是一个应用程序文件,用户可以双击以启动它,而无需安装任何程序.

Ideally, it would be a single application file that users may double-click to launch, without installing anything.

这怎么完成?

推荐答案

您可以制作一个用于安装JDK和应用程序的安装程序.使用 Launch4j 之类的应用程序将其作为exe;对于Mac可执行文件,请遵循Oracle的本教程:打包Java应用程序以便在Mac上分发,最后:对于Linux

You can make an installer that installs the JDK and the application. Make the application an exe by using something like Launch4j and for a Mac executable follow this tutorial by Oracle: Packaging a Java App for Distribution on a Mac and lastly: For Linux

我的世界使用了这种方法,据我所知,没有其他方法.

Minecraft uses this method and as far as that i don't know any other way.

如果您要制作可移植的应用程序,则制作一次可在任何地方运行"类型的应用程序,那么我建议尝试使用另一种编程语言,例如C#,它也需要.NET Runtime,但已嵌入Windows系统中,而Java需要手动安装.

If you want to make portable application, "make once run anywhere" type app then I'd suggest trying out a different programming language like C# which also requires the .NET Runtime but is embedded in Windows systems whereas Java needs to be installed manually.

这篇关于无需安装即可为不同平台创建独立的Java可执行文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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