A
Java applet is a
small application written in Java, and delivered to users in the form of
bytecode. The user launches the Java applet from a
web page. The Java applet then executes within a
Java Virtual Machine (JVM) in a
process separate from the
web browser itself, yet it can appear in a frame of the web page, in a new application window, 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 can be written in any
programming language that compiles to Java bytecode. They are usually written in
Java, but other languages such as
Jython,
JRuby, or
Eiffel (via
SmartEiffel), cater to the JVM.
Java applets run at very fast speeds comparable to, but generally slower than, other compiled languages such as
C++, but until approximately 2011, it had been many times faster than
JavaScript. In addition, they can use 3D
hardware acceleration that is available from Java. This makes applets well suited for non-trivial, computation intensive visualizations. As browsers have gained support for hardware accelerated graphics thanks to the
canvas technology (or specifically
WebGL in the case of 3D graphics), as well as
just in time compiled JavaScript, the speed difference has become less noticeable.
Since Java's
bytecode is
cross-platform (or platform independent), Java applets can be executed by browsers (or other
clients) for many platforms, including
Microsoft Windows,
FreeBSD,
Unix,
OS X and
Linux. It is also trivial to run a Java applet as an
application software with very little extra code so that it can be run directly from the
integrated development environment (IDE).