如何将我的Java程序转换为.exe文件? [英] How can I convert my Java program to an .exe file?

查看:461
本文介绍了如何将我的Java程序转换为.exe文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

If I have a Java source file (*.java) or a class file (*.class), how can I convert it to a .exe file?

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

I also need an installer for my program.

推荐答案

javapackager



javapackager


Java Packager工具编译,包,并准备Java和JavaFX应用程序以进行分发。 javapackager命令是命令行版本。

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

- Oracle的文档

– Oracle's documentation

javapackager 工具附带JDK。它可以使用 -native exe 标志生成.exe文件,以及许多其他内容。

The javapackager tool ships with the JDK. It can generate .exe files with the -native exe flag, among many other things.


WinRun4j是一个java窗户发射器。它是javaw.exe的替代品,并提供以下好处:

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


  • 使用INI文件指定classpath,main class,vm args,程序参数。

  • 任务管理器中显示的自定义可执行文件名。

  • 其他JVM参数可以更灵活地使用内存。

  • 内置图标替换器,用于自定义图标。

  • [更多项目符号关注]

  • 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的网页

– WinRun4J's webpage

这是第三方开源实用程序。它有许多功能,但它的发展在2013年左右开始放缓。

This is a third-party open source utility. It has many features, but its development has slowed after around 2013.


打包JAR,资产和JVM以便在Windows上分发, Linux和Mac OS X,添加本机可执行文件,使其看起来像本机应用程序。 Packr最适合GUI应用程序。

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自述文件

– packr README

这是另一个开源工具。它仍在积极开发中。

This is another open source tool. It's still actively developed.


InstallAnywhere使开发人员可以轻松地为任何平台创建专业的安装软件。借助InstallAnywhere,您可以快速适应行业变化,更快地进入市场并提供引人入胜的客户体验。并且在发货之前了解项目的OSS组件的漏洞。

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的网站

– InstallAnywhere's website

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

This is a commercial/enterprise program that generates installers for Java-based programs. It's probably capable of creating .exe files.

作为.exe文件的替代方案,您可以创建一个双击时自动运行的JAR文件,通过添加JAR清单的入口点

As an alternative to .exe files, you can create a JAR file that automatically runs when double-clicked, by adding an entry point to the JAR manifest.

Excelsior的文章将Java转换为EXE - 为什么,何时,何时以及如何

An excellent source of information on this topic is Excelsior's article "Convert Java to EXE – Why, When, When Not and How".

另请参阅配套文章最佳JAR到EXE转换工具,免费和商业

这篇关于如何将我的Java程序转换为.exe文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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