Java Applets and Webstart

Written by Larry Gray on . Posted in Applets / Webstart

Java Applets and Webstart

Java Applets

Java applets are mini-applications which run within another application. Applets actually could be run as a desktop application with Java's appletviewer.exe program. And actually, that may be the only way to make an applet run at the current day and time. Well, a better way to run an applet is to convert it to Web Start application which I talk about later on in this article.

Java applets were quit the rage when Java first appeared on the scene. Applets are primarily run on a web page. However over time they lost popularity. Reasons for this might include applets being to startup. Another was applets not starting up at all which usually had a fix but was frustrating enough from the end user point of view to cause a loss in popularity. Applets may have enjoyed their greatest success in the case of in house programming within corporations. One very well used applet to date might be the RPG game called Runescape. Other popular alternatives to the use of Applets were Javascript and Macromedia Flash. At any rate this gave rise to Java Web Start technology.

Applets are inserted into a web page with a single html applet tag. Later the standard changed on this and an html object tag was used instead. The tag gave the applet space on the page as a rectangular area of given dimensions in pixels. An applet might inhabit for example 400x400 on an 800x600 page.

Applet and Web start applications run in what is known as a Security Sandbox. This means that applets do not have access to ram, to hard drive space or any storage space. Well thy can store and read Java cookies. Cookies might be a whole other article. Javascript , Web Start, Java Servlets and JSP can also access cookies. Briefly a cook is 4096 byets of storage on your hard drive in text files where each cookies is a name=value pair. Don't worry, cookies can't have viruses or malware, though they can be read and written by any application on your computer that has not been controlled by security features, such as viruses and malware. This doesn't mean you should disable them however, it simply means you should be more careful about protecting your computer from viruses and malware.

Applets may also not make network connections to other computers. They can only connect back to the computer they were loaded from. These security restrictions can be relaxed in a number of ways. Applets can be signed and have security certificates. Or a user may install a Java security policy file which grants the applets permission to do potentially dangerous things. Or if the applet is loaded locally from the local hard drive it will have a different security policy and has access to the local system and networking. Applets do have usefulness which is why we now have the Java Web Start technology.

Java Web Start

Java Web Start technology is almost the same thing as the Java Applet technology except that it is a normal java application which runs in a Sandbox on your computer as a desktop GUI application with its own Frame. Security is the same for web start apps as it is for Applets. I do not have much to say about Java Web Start except to say that a special file type called .jnlp is needed to launch the web start app in a single mouse click on a web page link. It is then downloaded and started up in the sandbox. Applets and Web Start applications are both cached on the local hard drive in your browsers cache. Applets, Web Start Apps and cookies are all wiped off the hard drive with system cleanup task.