Can we convert Java byte-code to machine code in a Windows that will work without the JVM ? there are many tools that wrap Jar application into an executable like Launch4J but it's always an application that depend to JVM.
-
2gcc.gnu.org/javaarshajii– arshajii2014-05-30 17:46:59 +00:00Commented May 30, 2014 at 17:46
-
@arshajii Slightly better link might be - gcc.gnu.org/java/gcj2.htmlElliott Frisch– Elliott Frisch2014-05-30 17:48:53 +00:00Commented May 30, 2014 at 17:48
-
Better or not, but certainly more enlightening: gcc.gnu.org/java/status.htmlDmitry Leskov– Dmitry Leskov2014-06-01 11:46:39 +00:00Commented Jun 1, 2014 at 11:46
Add a comment
|
3 Answers
As it has been pointed out, GCJ is the way to go:
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.
They do have a manual to get you started.
2 Comments
Jesper
Note that it does not support a recent version of Java and you will still need runtime libraries, so it is of limited practical use.
Dmitry Leskov
For all practical purposes, GCJ has been a dead man walking ever since Sun open sourced Java under the same license. Today there is VMkit and some other projects, but they typically don't support Windows.
Without a JVM, running Java Programs can be achieved using GraalVM with alleged performance improvements. See https://www.graalvm.org/22.1/reference-manual/native-image/