使 Java 程序成为独立的 exe(无需 JVM 运行)
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/6700311/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Make Java program as independent exe (run without JVM)
提问by Eng.Fouad
Is there any way to make Java program as independent exe (run without JVM)?
有没有办法让Java程序成为独立的exe(没有JVM运行)?
采纳答案by Ladlestein
I've used Excelsior JETto compile my Java into a native executable file on Windows. It worked real well. There are always opportunities for gotchas - I think JNI is a problem - but I was pretty happy.
我使用Excelsior JET将我的 Java 编译成 Windows 上的本机可执行文件。它工作得很好。总是有机会遇到问题——我认为 JNI 是一个问题——但我很高兴。
回答by g051051
GCJ is a portable, optimizing, ahead-of-time compiler for the Java Programming Language. It can compile Java source code to Java bytecode (class files) or directly to native machine code, and Java bytecode to native machine code.
Compiled applications are linked with the GCJ runtime, libgcj, which provides the core class libraries, a garbage collector, and a bytecode interpreter. libgcj can dynamically load and interpret class files, resulting in mixed compiled/interpreted applications. It has been merged with GNU Classpath and supports most of the 1.4 libraries plus some 1.5 additions.
GCJ 是用于 Java 编程语言的可移植、优化、提前编译器。它可以将Java源代码编译为Java字节码(类文件)或直接编译为本地机器码,将Java字节码编译为本地机器码。
编译后的应用程序与 GCJ 运行时 libgcj 链接,后者提供核心类库、垃圾收集器和字节码解释器。libgcj 可以动态加载和解释类文件,导致混合编译/解释的应用程序。它已与 GNU Classpath 合并,并支持大多数 1.4 库以及一些 1.5 添加。
回答by zacheusz
look at this article http://www.excelsior-usa.com/articles/java-to-exe.htmland this answer How can I convert my Java program to an .exe file?
看看这篇文章http://www.excelsior-usa.com/articles/java-to-exe.html和这个答案如何将我的 Java 程序转换为 .exe 文件?