gpt4 book ai didi

java - 如何将 Java 程序转换为 .exe 文件?

转载 作者:行者123 更新时间:2023-11-29 21:52:12 25 4
gpt4 key购买 nike

如果我有 Java 源文件 (*.java) 或类文件 (*.class),如何将其转换为 .exe 文件?

我的程序还需要一个安装程序。

最佳答案

javapackager

The Java Packager tool compiles, packages, and prepares Java and JavaFX applications for distribution. The javapackager command is the command-line version.

– Oracle's documentation

javapackager 实用程序随 JDK 一起提供。除其他功能外,它还可以生成带有 -native exe 标志的 .exe 文件。

WinRun4J

WinRun4j is a java launcher for windows. It is an alternative to javaw.exe and provides the following benefits:

  • Uses an INI file for specifying classpath, main class, vm args, program args.
  • Custom executable name that appears in task manager.
  • Additional JVM args for more flexible memory use.
  • Built-in icon replacer for custom icon.
  • [more bullet points follow]

– WinRun4J's webpage

WinRun4J 是一个开源实用程序。它具有许多功能。

packr

Packages your JAR, assets and a JVM for distribution on Windows, Linux and Mac OS X, adding a native executable file to make it appear like a native app. Packr is most suitable for GUI applications.

– packr README

packr 是另一个开源工具。

JSmooth

JSmooth is a Java Executable Wrapper. It creates native Windows launchers (standard .exe) for your java applications. It makes java deployment much smoother and user-friendly, as it is able to find any installed Java VM by itself.

– JSmooth's website

JSmooth是开源的,有特色,但是很老了。最后一次发布是在 2007 年。

JexePack

JexePack is a command line tool (great for automated scripting) that allows you to package your Java application (class files), optionally along with its resources (like GIF/JPG/TXT/etc), into a single compressed 32-bit Windows EXE, which runs using Sun's Java Runtime Environment. Both console and windowed applications are supported.

– JexePack's website

JexePack 是试用软件。生产使用需要付费,使用该工具创建的exe文件在不付费的情况下会显示“提醒”。此外,最后一次发布是在 2013 年。

InstallAnywhere

InstallAnywhere makes it easy for developers to create professional installation software for any platform. With InstallAnywhere, you’ll adapt to industry changes quickly, get to market faster and deliver an engaging customer experience. And know the vulnerability of your project’s OSS components before you ship.

– InstallAnywhere's website

InstallAnywhere 是一个商业/企业软件包,可为基于 Java 的程序生成安装程序。它可能能够创建 .exe 文件。

可执行 JAR 文件

作为 .exe 文件的替代方案,您可以创建双击时自动运行的 JAR 文件,方法为 adding an entry point to the JAR manifest .

<小时/>

了解更多信息

有关此主题的优秀信息来源是这篇文章“Convert Java to EXE – Why, When, When Not and How”,作者:Dmitry Leskov

另请参阅配套页面“Best JAR to EXE Conversion Tools, Free and Commercial

关于java - 如何将 Java 程序转换为 .exe 文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33528544/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com