How do I create an .exe for a Java program?

JavaExe

Java Problem Overview


> 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?

Java Solutions


Solution 1 - Java

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

Solution 2 - Java

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!

Solution 3 - Java

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.

Solution 4 - Java

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

Solution 5 - Java

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

Solution 6 - Java

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

Solution 7 - Java

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

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionDónalView Question on Stackoverflow
Solution 1 - JavaJon SkeetView Answer on Stackoverflow
Solution 2 - JavaJohn TView Answer on Stackoverflow
Solution 3 - JavatonysView Answer on Stackoverflow
Solution 4 - JavaForrestView Answer on Stackoverflow
Solution 5 - JavaBrandon DuRetteView Answer on Stackoverflow
Solution 6 - JavaGreg MattesView Answer on Stackoverflow
Solution 7 - JavaIngoView Answer on Stackoverflow