Monday, 10 March 2014

Applets vs JWS vs Applications

Applets vs JWS vs Applications
How do you decide whether to use an Applet or a Java Web Start Application or an app installed with a conventional installer such as InstallAnywhere.
Applets vs JWS vs Applications
Feature
Applets
JWS
Applications
Requires browser to run?
Must wait for download every time?
How To Install
Just view a page containing the Applet.
Just click a button on a page to install theJWS application.
Download and run an install package.
Auto-updating
Digitally Signed
Yes, to do anything interesting. However, simple Applets can be unsigned.
usually
Client Prerequisites
Requires Java JREinstalled on machine and in browser.
Requires Java JRE installed on machine. Requires application/x-java-jnlp-file MIME type association tojavaws.exe set up in browser. Requires*.jnlp association to javaws.exe
The installer can automatically install aJRE for you. The install does not require a functioning JRE on the client to get started.
Server Prerequisites
just a vanilla HTTPserver to serve web pages and jar files. So no special server side code is needed.
requires *.jnlp files be served withapplication/x-java-jnlp-fileMIME type. Ideally you also install theJNLP protocol to serve jar changes more efficiently, though it is not necessary.
just a vanilla HTTPserver to serve web pages and exe files. So no special server side code is needed.
Ease of Writing
Must be designed as anApplet from the start.
You can turn any ordinary application into a JWS one by adding *.jnlp file and perhaps an installer class.
Requires an install script for the installer and an expensive install bundler.
User Comfort
Fear Factor
below average. Ironically, MS propaganda has users fearing Applets far more than JavaScript when, in actuality, Java is hundreds of times safer.
poor
This is how the user normally installs programs. The user can’t tell the install apart from another other install written in CC++.
File Placement
Difficult to find a spot to save your data. Requires signed Applets. You must ask the user then use the Preferencesapi or the server to persist that choice.
JWS automatically allocates you storage, but gives it an ugly meaningless directory name. You can ask the user where to put files as part of your application installer and use the Preferences api to persist it. You could get at the user.dir property to assign space.
User decides directory name as part of the installs, based on a default. The installer leaves notes where to find things for the application.
Start Up Time
Applets load in their entirely every time over the web. There is some caching.
JWS only downloads your app when it has changed. However it dithers quite along time deciding if it really reads to download it.
Especially if you use native compilation, the start up is quick, however, there is no guarantee you are using the latest version.
Speed of Execution
Your Applet must shareRAM (Random AccessMemory) with a fat RAM-hogging browser.
JWS always works with java.exeHotspot.
With a standalone app, you have the option ofAOT (Ahead OTime)compilation for extra speed.
Native Code
Using signed Applets is extremely difficult withJNI native code because of the difficulty of getting the DLL s installed suitably on the path.
JWS automatically handles placing JNIDLLs (Dynamic Link Libraries) on the path, and selecting the version, e.g. Mac or PC suitable for the current platform.
You need to use a third-party installer such as InstallAnywhere to arrange for the right version of the DLL s to installed and the path modified to point to them.