This will download the application resources from the jnlp file codebase into the webstart cache.
javaws -codebase [URL of alternate codebase] -import [path to application jnlp file]
This is very similar to the first example, except now application resources are downloaded from the alternate codebase during the import.
With -codebase and -import, you can now create a CD-Installer for your java web start application. Let's take a look at a real life example and see how to do that.
http://java.sun.com/products/javawebstart/apps/draw.jar
http://java.sun.com/products/javawebstart/apps/draw.jnlp
http://java.sun.com/products/javawebstart/apps/images/draw.jpg
In the draw.jnlp file, the codebase is set to:
http://java.sun.com/products/javawebstart/apps
To create the CD-Installer for Draw, you want to create a CD with the application resources, e.g, if the cd-rom is drive d, you want to have the following files in the cd:
d:\draw\draw.jnlp
d:\draw\draw.jar
d:\draw\images\draw.jpg
You can then use the following command to install the Draw application from the CD:
javaws -codebase file:/d:/draw -import d:\draw\draw.jnlp
Note: the argument to -codebase must be a URL. file:/d:/draw is the same as file:///d:/draw, which translates to the actual file path d:\draw. file://d:/draw is very different, it will actually tranlates to connect to host d, ftp://d/draw.
It will be more convenient to the end-user if you provide a setup program, so the user can just double-click on the setup program to install the Draw application. As a simple example, here is what you can do in setup.bat:
javaws -codebase file:. -import draw.jnlp
and put setup.bat in:
d:\draw\setup.bat
With this setup, the user can just navigate to the cd-rom directory, and double-click on the setup.bat file, and Java Web Start will do the actual cd-install.
Java Web Start will download the resource from d:\draw into the Web Start cache. The application will be installed as if it were started from java.sun.com (the codebase in the jnlp file). On consecutive launches of the Draw application, Java Web Start will check the original codebase at java.sun.com for available updates.
javaws -silent -codebase file:/d:/draw -import draw.jnlp
You can turn off the splash screen using the -Xnosplash switch:
javaws -Xnosplash -codebase file:/d:/draw -import draw.jnlp
Completely silent:
javaws -Xnosplash -silent -codebase file:/d:/draw -import draw.jnlp
javaws -shortcut -association -silent -codebase file:/d:/draw -import draw.jnlp
If -silent is not specified in the above example, and the application jnlp hints for shortcut/association, java web start will pop up the shortcut/association dialog if the user settings is to prompt.
When -shortcut option is not specified during -silent install, a shortcut will be created only if the application's jnlp file hints for a shortcut, and user's settings allow shortcuts w/o warning dialog.
With -silent -shortcut, a shortcut will be created only if users settings would either popup dialog, or allow w/o dialog.
Same behaviour with file associations.
javaws -system -codebase file:/d:/draw -import draw.jnlp
Click here for more information on how to setup the system cache