- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
如果我有 Java 源文件 (*.java) 或类文件 (*.class),如何将其转换为 .exe 文件?
我的程序还需要一个安装程序。
最佳答案
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 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 是一个开源实用程序。它具有许多功能。
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 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 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 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 文件。
作为 .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/
我是一名优秀的程序员,十分优秀!