Kashyap Kansara Kashyap Kansara - 5 months ago 39
C++ Question

Compiling java source code to native exe

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.

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.

Note: I am not talking about packers that wraps java classes in exe and ultimately requires jvm.


The only to-native-code Java compiler that I'm aware of is The GNU Compiler for the Javatm Programming Language.

But it's extremely unlikely you really need a to-native-code compiler. Packers like the ones you've dismissed can make your program entirely self contained, including installing a private JVM, seamlessly. I strongly recommend you check out the options in this question and its answers.