How about that: http://www.java-gaming.org/forums/index.php?topic=13064.0 (i got a better version if anybody is interested).
My game (http://www.aevumobscurum.com) runs 100% through Java Webstart. You can either start it throught the .jnlp link -OR- you install the program with Install4j (windows, linux, unix, mac (thnks swpalmer!)). Install4j does NOT install the game, but runs the .jnlp file. It looks like a regular type application (it integrates into the menu etc), but it contains only a stub to run the online .jnlp file. That way, people download & install the installer once. All updates I do are automatically downloaded through javaws. I upload a new release to my online webstart directory, and everybody is up to date!
There is still the issue with the local directory to store “scenario” files. That’s solved too. When you download the javaws .jar files, one of the files (aevumobscurum-scenario.jar) contains the scenario.zip. The program automatically unpacks the scenario.zip to the user’s home directory (e.g. c:\documents and settings\user\aevum-obscurum-scenario…). That’s the code that I used. It’s executed when the game starts.
Is this cool or what ;D
// find the scenario dir
this.scenarioDir = System.getProperty("user.home") + "/" + System.getProperty("webstart.dir");
// try to find scenario.zip and install if required
InputStream inputStream;
try {
inputStream = ResourceHookup.getInstance().getInputStream("scenario.zip");
}
catch (IOException e) {
// If no input stream, then there is no scenario.zip to be deployed!
return;
}
// unzip file to local file system
try {
ZipInputStream zis = new ZipInputStream(new BufferedInputStream(inputStream));
byte[] data = new byte[2048];
ZipEntry entry;
while ((entry = zis.getNextEntry()) != null) {
String path = getScenarioDir() + "/" + entry.getName();
if (entry.isDirectory()) {
// create dirs if necessary
File dir = new File(path);
dir.mkdirs();
}
else {
// create subdirs if necessary
File file = new File(path);
if (!file.exists()) {
// only copy if file doesn't exist
File dir = new File(file.getParent());
dir.mkdirs();
// write the file to the disk
OutputStream outputStream = new FileOutputStream(file);
OutputStream fos = new BufferedOutputStream(outputStream, data.length);
int count;
while ((count = zis.read(data, 0, data.length)) != -1) {
fos.write(data, 0, count);
}
fos.flush();
fos.close();
}
}
}
zis.close();
}
catch (IOException e) {
throw new AccessException("Cannot deploy scenario into " + getScenarioDir());
}