Java is a general-purpose, concurrent, class-based, object-oriented computer programming language that is specifically designed to have as few implementation dependencies as possible. It is intended to let application developers “write once, run anywhere” (WORA), meaning that code that runs on one platform does not need to be recompiled to run on another. Java applications are typically compiled to bytecode (class file) that can run on any Java virtual machine (JVM) regardless of computer architecture. Java is, as of 2012, one of the most popular programming languages in use, particularly for client-server web applications, with a reported 10 million users.Java was originally developed by James Gosling at Sun Microsystems (which has since merged into Oracle Corporation) and released in 1995 as a core component of Sun Microsystems Java platform. The language derives much of its syntax from C and C++, but it has fewer low-level facilities than either of them.
What is J2SE?
J2SE is a collection of Java Programming Language API (Application programming interface) that is very useful to many Java platform programs. It is derived from one of the most dynamic programming language known as “JAVA”. Java is the creation of Sun Microsystems. and one of its three basic editions of Java known as Java standard edition being used for writing Applets and other web based applications.
Java has advanced through the years in both functionality and reach. Current editions are on the Java 2 Platform. The Java 2 Platform has various incarnations as well, including Java 2 Platform.
The Java 2 Platform has three basic Editions-
1. Java 2 Standard Edition (J2SE): J2SE is used primarily for writing applets and other Java-based applications.
2. Java 2 Enterprise Edition (J2EE): J2EE is the Java architecture for developing multitier enterprise applications. As part of J2EE, JSP pages have access to all J2EE components, including JavaBeans and Enterprise JavaBeans components and Java servlets. JSP pages are actually compiled into servlets, so they have all of the benefits of these flexible, server-side Java applications.
3. Java 2 Micro Edition (J2ME): J2ME is a technology that allows programmers to use the java programming language and related tools to develop programs for mobile wireless information devices such as cellular phones and personal digital assistants (PDAs).
Where it is used?
According to Sun, 3 billion devices run java. There are many devices where java is currently used. Some of them are as follows:
- Desktop Applications such as acrobat reader, media player, antivirus etc.
- Web Applications such as irctc.co.in, magicbricks.com etc.
- Enterprise Applications such as banking applications.
- Mobile
- Embedded System
- Smart Card
- Robotics
- Games etc.
Java Application Types-
There are 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.