Java applet

Started by sukishan, Jul 15, 2009, 02:03 PM

Previous topic - Next topic

sukishan

A Java applet is an applet delivered to the users in the form of Java bytecode. Java applets can run in a Web browser using a Java Virtual Machine (JVM), or in Sun's AppletViewer, a stand-alone tool for testing applets. Java applets were introduced in the first version of the Java language in 1995. Java applets are usually written in the Java programming language but they can also be written in other languages that compile to Java bytecode such as Jython.

Applets are used to provide interactive features to web applications that cannot be provided by HTML. Since Java's bytecode is platform independent, Java applets can be executed by browsers for many platforms, including Windows, Unix, Mac OS and Linux. There are open source tools like applet2app which can be used to convert an applet to a stand alone Java application/windows executable/linux executable. This has the advantage of running a Java applet in offline mode without the need for internet browser software.

Many influential Java developers, blogs and magazines are recommending that the Java Web Start technology be used in place of Applets


Advantages
A Java applet can have any or all of the following advantages:

it is simple to make it work on Linux, Windows and Mac OS i.e. to make it cross platform
the same applet can work on "all" installed versions of Java at the same time, rather than just the latest plug-in version only. However, if an applet requires a later version of the JRE the client will be forced to wait during the large download.
it is supported by most web browsers
it will cache in most web browsers, so will be quick to load when returning to a web page but may get stuck in the cache and have issues when new versions come out.
it can have full access to the machine it is running on if the user agrees
it can improve with use: after a first applet is run, the JVM is already running and starts quickly, benefitting regular users of Java but the JVM will need to restart each time the browser starts fresh.
it can run at a speed that is comparable to (but generally slower than) other compiled languages such as C++, but many times faster than JavaScript
it can move the work from the server to the client, making a web solution more scalable with the number of users/clients
developers can develop and debug an applet direct simply by creating a main routine (either in the applet's class or in a separate class) and call init() and start() on the applet, thus allowing for development in their favorite J2SE development environment. All one has to do after that is re-test the applet in the appletviewer program or a web browser to ensure it conforms to security restrictions.

Disadvantages

A Java applet may have any of the following disadvantages:

It requires the Java plug-in, which isn't available by default on all web browsers.
Prior to version 6u12, Sun did not provide a 64-bit version of its Java plug-in, forcing users to use the 32-bit plugin with a 32-bit browser.
It cannot start until the Java Virtual Machine is running, and this may have significant startup time the first time it is used.
If untrusted, it has severely limited access to the user's system - in particular having no direct access to the client's disk or clipboard (although some would argue that this is a security benefit instead of a disadvantage, as ad-hoc unrestricted access to a client's disk would be incredibly dangerous).
Some organizations only allow software installed by the administrators. As a result, many users cannot view applets by default.
Applets may require a specific JRE.
A good beginning makes a good ending