This section reviews different types of Java applications before moving on to Servlets.
Java can be used to develop different types of applications:
• Standalone Applications
• Applets
• Web Applications
• Distributed Applications

Standalone Applications
A standalone application is a program that runs on your computer. It is more or less like a C or C++ program.

Applets

An applet is an application designed to travel over the Internet and to be executed on the client machine by a
Java-Compatible web browser like Internet Explorer or Netscape. Applets are also Java programs but they
reside on the servers. An applet can not be executed like standalone application. Applet can be executed only
by embedding it into an HTML page like an image or sound file. To run an applet you need to access an HTML
page which has applet embedded into it. When the web browser downloads such an HTML page, it
subsequently loads the executable file, which contains Applet and then executes it on the local machine.

Web Applications
Web applications run on the Web Server. Web applications are accessed through web clients i.e. web browsers
like Internet Explorer or Netscape. Whenever you access some web site by specifying the URL (Universal
Resource Locator), you are accessing some web application. The main components of a web application written
in Java are:

Java Servlets
Java Server Pages (JSP), and
HTML

Java Servlets are also Java programs, which run on the Server and then send the result/response to the client.
JSP pages can be thought of as a combination of HTML and Java Code. The Web Server converts JSP pages
into Java Servlets before execution.

You access the web application by specifying the URL. If the URL corresponds to an HTML page the web
server simply returns the HTML page to the client, which then displays it. If the URL corresponds to the Servlet
or JSP then it is executed on the Server and the result/response is returned to the client, which is then displayed
by the client.

Distributed Applications
Java application can be divided into a number of modules/components (Java programs), which can run on
different machines. The Java programs/applications running on different machines can communicate with each
other. To be more precise the Java Objects on one machine can invoke methods on the Java Objects running on
another machine. Thus Java has the support for the distributed processing in the language itself.