This seems to mix two different questions:
1) how to write a Java program in a platform-independent way, and
2) how to create in installer that can install a Java program on a machine where Java itself is not installed.
as to #1, Java itself is largely platform-independent. An interesting question would be how to make a pure-Java application behave more like a native application on each OS where it is run.
This article talks about how to do that in Swing applications.
as to #2, there are several -mostly commercial- packages that create installers which will download and install Java if it is not there already.
InstallAnywhere is the one mentioned most often.
[ June 21, 2006: Message edited by: Ulf Dittmer ]