57

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?

4
  • 1
    Duplicate of stackoverflow.com/questions/147181/… and stackoverflow.com/questions/309329/… (and that's just from the "Related" section). Commented Feb 5, 2009 at 15:40
  • Could you tell us the reason why you want a .exe file? Why isn't an executable .jar enough? Commented Feb 5, 2009 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. Commented Mar 17, 2012 at 2:49
  • plus I get the problem with the manifest file Commented May 16, 2012 at 8:44

7 Answers 7

37

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

Sign up to request clarification or add additional context in comments.

2 Comments

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 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.
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.
25

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!

Comments

9

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.

Comments

4

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

Comments

3

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

Comments

2

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

Comments

-5

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

2 Comments

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.
-1 this just doesn't answer the question...

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.