The SitePoint Forums have moved.

You can now find them here.
This forum is now closed to new posts, but you can browse existing content.
You can find out more information about the move and how to open a new account (if necessary) here.
If you get stuck you can get support by emailing forums@sitepoint.com

If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

I have messed around with JAVA for some time now and have never figured out how to make my little programs standalone applications that I can distribute. How do I go about making a JAVA application distributable, so that someone can double click on its icon (still got to figure out how to make those too) and the program starts.

Also, does anyone know of a window creator for JAVA? I am kind of tired of writing all of the windowing code that my apps require.

You can pack all the .java files used in a program into a single .jar file. I believe this can be made to execute automatically when clicked. It probably just executes the 'main' method. While I havn't used this myself, I have seen it done quite a few times. Assuming you are using a Windows environment, type jar /? in a DOS prompt for instructions on using it.

There are a few visual design tools around, I think JBuilder is one, not sure of any others. However, be careful when using these, I have alwayse been told that it is better to write the GUI's yourself, as the visual tools put in a LOT of useless code which bloat your programs.

Yep -- JAR files are the way to go. By specifying the name of the class containing the main function in the JAR files manifest (a plain text file in the archive containing information about the packaged application), the JAR file becomes executable. You can then run the program from the command line by typing:

java -jar jarfile.jar

Also, any Windows system with the JDK or JRE installed can launch such JAR files by double-clicking on them.

Another option is a program called InstallAnywhere. This lets you package your application as a Windows .exe (or an executable file for Unix/Linux) that installs the program just like a native Windows application, with a Start menu icon and everything. "InstallAnywhere Now" is a free version of this utility, while the commercial version, "InstallAnywhere Pro", will also automatically install the JRE if neccessary, and provides more options for branding, etc. Check it out at http://www.installanywhere.com/.