55

Possible Duplicate:
How can I convert my java program to an .exe file ?

I'd like to create a Windows .exe for a Java program. Previously, I've used JEXECreator for this, but it's not entirely satisfactory because:

  • The executable sometimes works on the machine on which it was created but not on others.
  • The program is commercial; if you use the trial version, it adds a nag screen to your application.

I don't need the generated .exe to work if Java is not installed on the target machine (in fact, I think this is impossible).

Any recommendations?

Community
  • 1
  • 1
Dónal
  • 185,044
  • 174
  • 569
  • 824
  • 1
    Duplicate of http://stackoverflow.com/questions/147181/how-can-i-convert-my-java-program-to-an-exe-file and http://stackoverflow.com/questions/309329/best-free-tool-to-build-an-exe-from-java-code (and that's just from the "Related" section). – Michael Myers Feb 05 '09 at 15:40
  • Could you tell us the reason why you want a .exe file? Why isn't an executable .jar enough? – Joachim Sauer Feb 05 '09 at 15:41
  • It's certainly not impossible to compile JVM bytecode to native machine bytecode. The GNU java compiler does it as well as others. – Deddryk Mar 17 '12 at 02:49
  • plus I get the problem with the manifest file – basickarl May 16 '12 at 08:44

7 Answers7

36

Launch4j perhaps? Can't say I've used it myself, but it sounds like what you're after.

Jon Skeet
  • 1,421,763
  • 867
  • 9,128
  • 9,194
  • 2
    May I also suggest if you need to create a native app for more than just Windows then JWrapper allows you to [create native apps from Java](http://www.jwrapper.com/) on the main platforms (Windows Linux, Mac) for free. It runs on any OS, supports built-in code signing, iconifying and auto-updating, and it can optionally bundle the JRE in a very small (heavily compressed) package. – AntonyM Feb 20 '13 at 12:01
  • I was about to suggest JWrapper before I saw @AntonyM 's comment.. JWrapper is my best advice if you're looking to support multiple OS. – Taslim Oseni Jan 22 '18 at 17:01
24

Most of the programs that convert java applications to .exe files are just wrappers around the program, and the end user will still need the JRE installed to run it. As far as I know there aren't any converters that will make it a native executable from bytecode (There have been attempts, but if any turned out successful you would hear of them by now).

As for wrappers, the best ones i've used (as previously suggested) are:

JSmooth

and

Launch4j

best of luck!

Community
  • 1
  • 1
John T
  • 23,735
  • 11
  • 56
  • 82
8

If you really want an exe Excelsior JET is a professional level product that compiles to native code:

http://www.excelsior-usa.com/jet.html

You can also look at JSMooth:

http://jsmooth.sourceforge.net/

And if your application is compatible with its compatible with AWT/Apache classpath then GCJ compiles to native exe.

tonys
  • 3,855
  • 33
  • 39
3

I used exe4j to package all java jars into one final .exe file, which user can use it as normal windows application.

Forrest
  • 579
  • 2
  • 9
  • 16
2

You could try exe4j. This is effectively what we use through its cousin install4j.

Brandon DuRette
  • 4,810
  • 5
  • 25
  • 31
1

The Java Service Wrapper might help you, depending on your requirements.

Greg Mattes
  • 33,090
  • 15
  • 73
  • 105
-5

If Java is installed on the target machine, there is no need to create an .exe file. A .jar file should be sufficient.

jon hanson
  • 8,722
  • 2
  • 37
  • 61
  • 28
    If the end-user is non-technical, then a .jar file is sufficient only if Java is installed on the target machine *and* java.exe is on the PATH *and* the main class is specified in the manifest file. in general, .exes are a bit simpler for non-technical people to execute. – Dónal Sep 08 '09 at 19:23
  • 12
    -1 this just doesn't answer the question... – Richard Le Mesurier Mar 05 '13 at 11:01