Sun's Deployment Toolkit contains a function for installing a specific JRE version, but it requires the use of a web browser. How can a desktop application download the JRE programmatically (without the use of a browser)?
You can use java web start to launch an application from a desktop shortcut as well. If you do, then the web start framework can download and install JREs just as if it was started from a browser.
If you distribute the application as a browser based web start application then you can set properties in the jnlp file that creates start menu and/or desktop icons on first launch. If you choose another distribution form you can manually create a shortcut that will call javaws instead.
You can use JSmooth to check for Java at launch time, which will then allow for the user to install it.
If you want a silent install, you need the MSI version (for Windows), which is as far as I know not publicly available.
You might want to check out Sun's kernel installer for Java - it's fairly small, and takes care of downloading and installing out to a full JVM in the background. Depending on how you deploy your app, this might be small enough to just include it. In our app, even this installer is too big, so we detect the current installed JRE, then download the kernel installer if we detect that it's necessary.
You can always use an http download (outside of a Web browser) from your installation system to get the kernel installer, then run it. We use NSIS and there are a number of http download libraries that work quite well for this. There are also several NSIS plugins that can detect the correct version of Java. The combination of those two pieces of functionality have always been sufficient for us.
EDIT - if you are using NSIS, here's a plugin that will download a file via http or ftp from inside the installation.
and here's a full featured Java launcher using NSIS. I don't care for the specific technique of actually starting the app - using javaw.exe - but the general approach of detecting the JRE version, UAC elevation, downloading the JRE installer is sound. We have our own launcher (instead of java.exe) that allows us to have our own process name, icons, etc...
Personally, I recommend doing this sort of work in the installation itself.