This question already has an answer here:
I have programmed a Java Program in JCreator, everything is done, but I want to create an executable file from it, ie I dont want to have to run the program by loading the java classes and compiling then executing, but instead have it as a stand alone executable file.
What the quickest way to do this?
Java Web Start is a good technology for installing Java rich clients off the internet direct to the end user's desktop (whether the OS is Windows, Mac or *nix). It comes complete with desktop integration and automatic updates, among many other goodies.
For more information on JWS, see the JWS info page.
Jexecutable can create Windows exe for Java programs. It embeds the jars into exe file and you can run it like a Windows program.
I'm not quite sure what you mean.
But I assume you mean either 1 of 2 things.
Eclipse can do this really easily File --> Export and create a jar and select the appropriate Main-Class and it'll generate the .jar for you. In windows you may have to associate .jar with the java runtime. aka Hold shift down, Right Click "open with" browse to your jvm and associate it with javaw.exe
http://jsmooth.sourceforge.net/ or http://launch4j.sourceforge.net/ will create a native .exe stub with a nice icon that will essentially bootstrap your app. They even figure out if your customer hasn't got a JVM installed and prompt you to get one.
On the command line, navigate to the root directory of the Java files you wish to make executable.
Use this command:
This will create a directory called META-INF in the jar archive. In this META-INF there is a file called MANIFEST.MF, open this file in a text editor and add the following line:
then use this command:
and your program will run :)
Write a script and make it executable. The script should look like what you'd normally use at the command line:
This assumes you've already compiled your .java files and that the java can find your .class files. If java cannot find your .class files, you may want to look at using the -classpath option or setting your CLASSPATH environment variable.
As suggested earlier too, you can look at launch4j to create the executable for your JAR file. Also, there is something called "JExePack" that can put an .exe wrapper around your jar file so that you can redistribute it (note: the client would anyways need a JRE to run the program on his pc) Exes created with GCJ will not have this dependency but the process is a little more involved.