Is there any way to make Java program as independent exe (run without JVM)?
-
Why do you have this question on your mind? – CoolBeans Jul 14 '11 at 21:48
-
I made a simple gui program, and I want it to be executable in any computer (windows) without installing JVM – Eng.Fouad Jul 14 '11 at 21:49
-
1People is making and answering this question since 2000... Just Google – gd1 Jul 14 '11 at 21:50
-
At some level, you will always have a JVM for java code. The best you could do is have some executable launcher, but it will still reference a JVM somewhere along the line. – Riaan Cornelius Jul 14 '11 at 21:51
-
I wonder why all these downvotes :( – Eng.Fouad Jul 14 '11 at 21:51
-
Eng.Fouad: you get 'em because this is an old topic – gd1 Jul 14 '11 at 21:52
-
but old topics did not mentioned the part "without JVM" – Eng.Fouad Jul 14 '11 at 21:55
-
1@Eng: oh yes, that has been specifically asked *many* times. – Hovercraft Full Of Eels Jul 14 '11 at 22:32
3 Answers
I've used Excelsior JET to 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.

- 6,100
- 2
- 37
- 49
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.
:) Just a example, you can build exe with internal JVM and user will see just exe file but your JAVA program will start and work on internal JVM for this case you can use exe4j

- 5,389
- 5
- 28
- 45