In most cases you don't. You create a JAR file, and maybe a Java Web Start file.
If they don't do what you want, you look at Java Aware Installers (Install Anywhere for example), and other Java packaging tools.
Then, and only then do you look at "native compilers". JET and GCJ.
Now if you bothered searching, you would have seen that this question is asked about once a week.
Message was edited by:
mlk
How very un-cross-platform-like ;)
I always thought the most portable solution was to stick with a JAR file and create a .exe which is nothing more than a launcher invoking java with the relevant commands. On OS X you can do the same sort of thing by bundling everything into a appName.app directory and in *nix (and OS X for that matter) you can write a shell script.
Same code, different launchers :)
> How very un-cross-platform-like ;)
>
> I always thought the most portable solution was to
> stick with a JAR file and create a .exe which is
> nothing more than a launcher invoking java with the
> relevant commands. On OS X you can do the same sort
> of thing by bundling everything into a appName.app
> directory and in *nix (and OS X for that matter) you
> can write a shell script.
>
> Same code, different launchers :)
you mean like eclipse? incidentally, eclipse can convert your jars to OSGi bundles for you, then export the lot for you, with just such a native launcher. messy, but it does what people repeatedly seem convinced they need to do
> > What is the best way to compile your program into a
> .exe?
>
> The best way is not to do it.
Amen. The OP was just whipping up something over Spring break,
not trying to deploy something for the masses. Let's not overcomplicate
things: an executable JAR is just the ticket: http://java.sun.com/docs/books/tutorial/deployment/jar/index.html