问题描述
是否可以将Java源代码编译为C ++之类的本机exe?像C ++一样,所有头文件都包含在编译过程中,所有必需的Java库文件都应附加在该exe文件中,并且该exe文件不应是字节码,而应是本机exe,并且无需jvm即可运行.
Is it possible to compile java source code into native exe like C++?Like C++ all headers files are included during compilation, all java library files that are required should be attached in that exe, and this exe should not be a bytecode but native exe instead and run without jvm.
所以我想知道的是..如果我可以用Java语法替换所有C ++语法并编译成一个exe文件,例如由C ++编译器直接运行的exe文件.
So all I want to know is something like.. if I can replace all C++ syntax with Java syntax and compile to an exe file like one created by C++ compiler which run directly.
注意:我不是在说将exe中的Java类包装起来并最终需要jvm的包装器.
推荐答案
我知道的唯一的本地代码Java编译器是用于Java 编程语言的GNU编译器.
The only to-native-code Java compiler that I'm aware of is The GNU Compiler for the Java Programming Language.
但是 极其不可能 ,您确实需要使用本机代码编译器.像您解雇的那种打包程序可以使您的程序完全独立,包括无缝安装私有JVM.我强烈建议您在此查看选项问题及其答案.
这篇关于将Java源代码编译为本机exe的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!