Hi fellow game-devs,
After some serious working with JavaWebStart for a
long time, I found it too much hassle. There are a lot
of features that are not required, and there are a lot
restrictions that are a pain in the back. Not to mention
the annoying bugs (pop-under dialogs, shortcut
dialogs behind fullscreen window). All destroying the
firsttime impression of the end-user, which is very
dangerous if we’re trying to make money.
From my experience: the most reliable way to deploy
your application is to have native-launchers (that is, an
app to launch the JVM, nothing more). But then you
loose that magic auto-update that, I have to say,
really kicks butt in JWS.
To fill the gap (at least it was a gap for me), I have
written an AutoUpdate API that is similar to the one in
JWS, but with a few additional features:
- you have full control where the update-files are deployed (subdir="/")
- you can simply store the downloaded file (action=“store”),
- you can extract downloaded zip-archives ‘on the fly’ (action=“extract”)
- check for conditions before the file is downloaded:
(linked to System.getProperty()…)
Update: check next posts for improved syntax
There is a file on a http-server with data like:
<netupdate>
<resource>
<remote url="http://yourserver.com/engine.jar" />
<local subdir="/lib/" file="engine.jar" action="store" />
</resource>
<resource>
<remote url="http://yourserver.com/logo.png" />
<local subdir="/" file="image.png" action="store" />
</resource>
<resource>
<condition property="os.name" contains="Windows" />
<remote url="http://yourserver.com/game-bin-win32.zip" />
<local subdir="/bin/" file="game-bin-win32.zip" action="extract" />
</resource>
<resource>
<condition property="os.name" contains="Linux" />
<remote url="http://yourserver.com/game-bin-linux.zip" />
<local subdir="/bin/" file="game-bin-linux.zip" action="extract" />
</resource>
</netupdate>
Once you launched your deployed application, simply do:
[Update: whenever you want, or let the end-user choose]
String url = "http://yourserver.com/your_info_file.txt";
String applicationDirectory = "D:/your_app/";
NetFeedback feedback = ...;
NetUpdate.update(url, applicationDirectory, feedback);
NetFeedback is an interface that gives ‘feedback’ about
the updating-process:
// called when something happens:
// - "file {...} already up-to-date"
// - "condition for file {...} not met",
// - "downloading file {...}"
// - etc etc
public void notification(String message);
// called every 250ms, if downloading/extracting
public void statistics(int kbps, int size, float progress);
// called on error
public void error(Exception exc);
// called when done
public void finished();
This enables you to fit this in your own app, with your
own GUI, just listening to the feedback.
A single addition file is created in the Application-dir,
containing the lastModified values of all relevant files.
Deleting this file will result in a complete update the
next time the update process is launched.
To check if an update is required, these values are
compared against the URLConnection.lastModified();
of each Resource (in the xml file).
Side note: java.io.File.lastModified() cannot be used if
a zip-archive was extracted - and deleted after that.
Everything is completely transparant to the dev!
No magic behind the scenes!
So… is there a demand for this API, should make it public?
I would like to hear feedback! :-*