tags:

views:

1647

answers:

7

Hi,

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 work on the machine on which it was created but not on others
  • The program is comercial. 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?

Cheers, Donal

+6  A: 

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

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.
Don
+7  A: 

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

Jon Skeet
+2  A: 

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
+5  A: 

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!

John T
A: 

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

Greg Mattes
A: 

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

Brandon DuRette
A: 

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

Forrest