Saturday, 21 December 2013

How to know the .class is complied by which jdk version?

In a compiled class (.class file) we see is “ca fe ba be”. This is the java magic number which says that this is a java binary class file. It is immediately followed by minor_version and then major_version.

Sample hex view of a java binary class:
ca fe ba be 00 00 00 32 ...

Sunday, 15 December 2013

Java Server Pages

Java Server Faces (JSF) is a Java-based web application framework intended to simplify development integration of web-based user interfaces.

JSF 2 uses Facelets as its default templating system. Other view technologies such as XUL can also be employed. In contrast, JSF 1.x uses JavaServer Pages (JSP) as its default templating system.

JSF is often used together with Ajax, a Rich Internet application technology. Ajax is a combination of technologies that make it possible to create rich user interfaces. The user interface components in Mojarra and Apache MyFaces were originally developed for HTML only, and Ajax had to be added via JavaScript.

Latest developments

Facelets (which was designed specifically for JavaServer Faces) was adopted as the official view technology for JSF 2.0. This eliminates the life-cycle conflicts that existed with JSP, forcing workarounds by Java developers. Facelets allows easy component/tag creation using XML markup instead of Java code, the chief complaint against JSF 1.x.

The new JSF developments also provide wide accessibility to Java 5 annotations such as @ManagedBean, @ManagedProperty and @FacesComponent which removes the need for faces-config.xml in all cases except framework extension. Navigation has been simplified, removing the need for faces-config.xml navigation cases. Page transitions can be invoked simply by passing the name of the desired View/Facelet.

Addition of Partial State Saving and DOM updates are part of the built in standardized Ajax support.
The latest JSF release has built-in support for handling resources like images, CSS and Javascript, allowing artifacts to be included with component libraries, separated into JAR files, or simply co-located into a consistent place within the web-application. Includes logical naming and versioning of resources.

JSF 2.0 also includes a number of other changes like adding support for events, separate development, staging, and production modes, similar to RAILS_ENV in Ruby on Rails, and significantly expanding the standard set of components.

 

 

Saturday, 9 November 2013

No SQL vs SQL

Types


SQL      : One type (SQL database) with minor variations

No SQL : Many different types including key-value stores, document databases, wide-column stores, and graph databases

Development History

SQL      : Developed in 1970s to deal with first wave of data storage applications

No SQL : Developed in 2000s to deal with limitations of SQL databases, particularly concerning scale, replication and unstructured data storage

Examples

SQL      : MySQL, Postgres, Oracle Database

No SQL : MongoDB, Cassandra, HBase, Neo4j

Data Storage Model

SQL      : Individual records are stored as rows in tables, with each column storing a specific piece of data about that record

No SQL : Varies based on database type. For example, key-value stores function similarly to SQL databases, but have only two columns ("key" and "value"), with more complex information sometimes stored within the "value" columns. Document databases do away with the table-and-row model altogether, storing all relevant data together in single "document" in JSON, XML, or another format, which can nest values hierarchically.

Schemas

SQL : Vertically, meaning a single server must be made increasingly powerful in order to deal with increased demand.

No SQL : Horizontally,The database automatically spreads data across servers as necessary

Development Model

SQL : Mix of open-source (e.g., Postgres, MySQL) and closed source (e.g., Oracle Database)

No SQL :  Open-source

Supports Transactions

SQL : Yes, updates can be configured to complete entirely or not at all

No SQL :  In certain circumstances and at certain levels (e.g., document level vs. database level)

Data Manipulation

SQL : Specific language using Select, Insert, and Update statements, e.g. SELECT fields FROM table WHERE…

No SQL : Through object-oriented APIs

Consistency
SQL : Can be configured for strong consistency

No SQL : Depends on product. Some provide strong consistency (e.g., MongoDB) whereas others offer eventual consistency (e.g., Cassandra)

No SQL

No SQL
  • A NoSQL database provides a mechanism for storage and retrieval of data that employs less constrained consistency models than traditional relational databases. 
  •  NoSQL databases are finding significant and growing industry use in big data and real-time web applications.
  •   NoSQL systems are also referred to as "Not only SQL" to emphasize that they may in fact allow SQL-like query languages to be used.

NoSQL encompasses a wide variety of different database technologies and were developed in response to a rise in the volume of data stored about users, objects and products, the frequency in which this data is accessed, and performance and processing needs. Relational databases, on the other hand, were not designed to cope with the scale and agility challenges that face modern applications, nor were they built to take advantage of the cheap storage and processing power available today. 

The Benefits of NoSQL

When compared to relational databases, NoSQL databases are more scalable and provide superior performance, and their data model addresses several issues that the relational model is not designed to address:
  • Large volumes of structured, semi-structured, and unstructured data
  • Agile sprints, quick iteration, and frequent code pushes
  • Object-oriented programming that is easy to use and flexible
  • Efficient, scale-out architecture instead of expensive, monolithic architecture

NoSQL Database Types

  • Document databases pair each key with a complex data structure known as a document. Documents can contain many different key-value pairs, or key-array pairs, or even nested documents.
  • Graph stores are used to store information about networks, such as social connections. Graph stores include Neo4J and HyperGraphDB.
  • Key-value stores are the simplest NoSQL databases. Every single item in the database is stored as an attribute name (or "key"), together with its value. Examples of key-value stores are Riak and Voldemort. Some key-value stores, such as Redis, allow each value to have a type, such as "integer", which adds functionality.
  • Wide-column stores such as Cassandra and HBase are optimized for queries over large datasets, and store columns of data together, instead of rows.

Saturday, 26 October 2013

How to avoid deadlock in Java Threads

What is deadlock ?

 When two or more threads waiting for each other to release lock and get stuck for infinite time , situation is called deadlock . it will only happen in case of multitasking.

How do you detect deadlock in Java ?
 
if nested synchronized block or calling one synchronized method from other or trying to get lock on different object then there is good chance of deadlock if developer is not very careful.

write code which will result in deadlock ?

public void method1(){
synchronized(String.class){
System.out.println("Aquired lock on String.class object");

synchronized (Integer.class) {
System.out.println("Aquired lock on Integer.class object");
}
}
}

public void method2(){
synchronized(Integer.class){
System.out.println("Aquired lock on Integer.class object");

synchronized (String.class) {
System.out.println("Aquired lock on String.class object");
}
}
}

How to avoid deadlock in Java ?
 
public void method1(){
synchronized(Integer.class){
System.out.println("Aquired lock on Integer.class object");

synchronized (String.class) {
System.out.println("Aquired lock on String.class object");
}
}
}

public void method2(){
synchronized(Integer.class){
System.out.println("Aquired lock on Integer.class object");

synchronized (String.class) {
System.out.println("Aquired lock on String.class object");
}
}
}


 

Now there would not be any deadlock because both method is accessing lock on Integer and String object in same order . so if thread A acquires lock on Integer object , thread B will not proceed until thread A releases Integer lock , same way thread A will not be blocked even if thread B holds String lock because now thread B will not expect thread A to release Integer lock to proceed further.

 

Sunday, 20 October 2013

Java Memory Types

Java has only two types of memory when it comes to JVM.

Heap memory and Non-heap memory.

Heap Memory

Class instances and arrays are stored in heap memory. Heap memory is also called as shared memory. As this is the place where multiple threads will share the same data.

Non-heap Memory

It comprises of ‘Method Area’ and other memory required for internal processing. So here the major player is ‘Method Area’.

Method Area

As given in the last line, method area is part of non-heap memory. It stores per-class structures, code for methods and constructors. Per-class structure means run time constants and static fields.


Memory Pool

Memory pools are created by JVM memory managers during run time. Memory pool may belong to either heap or non-heap memory.

Runtime Constant Pool

A run time constant pool is a per-class or per-interface run time representation of the constant_pool table in a class file. Each run time constant pool is allocated from the Java virtual machine’s method
area.
jvm memory

Saturday, 19 October 2013

Abstract class vs Interface

Abstract class:
  • cannot be instantiated.
  • is a special type of class in which you can have members without implementation.
  • as we know in C#/VB/Java, a class can only inherit from 1 class. This also applies for Abstract Class.
  • normally used for framework-type library classes: providing default behavior for some of its class members, but forcing the developer to implement others.
  • is believed to be faster in Java,
  • the aim: making sure something is *eventually* implemented.
  • A class can inherit an abstract class without implementing all its abstract method.
    However only a class that has all its method implemented can be instantiated to an object.
  • IS-A relationship.
  • e.g. Student IS A Person, Employee IS A Person.
// 'framework library' for a person
// a person can enrol and submit
// however, the class that consume this framework library
// need to provide 'where' the paperwork need to be sent
public abstract Person
{
    public abstract SendPaperWork(string paperwork)

    public void Enrol()
    {
        SendPaperWork("enrolment");
    }

    public void Submit()
    {
        SendPaperWork("report");
    }
}

// by inheriting Person abstract class
// we are enabling student to enrol and submit
// however, SendPaperWork need to be implemented
// because we need to tell it explicitly 'where' 
// to send the enrolment/ submission
public class Student : Person
{
    public override SendPaperWork(string paperwork)
    {
        School.Send(paperwork);
    }
}

// an employee send the paperwork to a different 'place' than student
public class Employee : Person
{
    public override SendPaperWork(string paperwork)
    {
        Company.Send(paperwork);
    }
}
Interface:
  • cannot be instantiated.
  • is a special type of abstract class in which all the members do not have any implementations.
  • enables polymorphism. A class can implement more than 1 Interfaces.
  • normally used for application classes: providing contract for ensuring interactibility.
  • the aim: making sure something is interchangeable.
  • A class that implements an Interface need to contain all the implementation, otherwise the compiler will throw an error.
  • CAN-DO relationship.
  • e.g. Student CAN enrol, Student CAN submit assignment.
public interface ICanEnrol
{
    void Enrol();
}

public interface ICanSubmit
{
    void Submit();
}

public class Student : ICanEnrol, ICanSubmit
{
    public void Enrol()
    {
        School.Send("enrolment");
    }

    public void Submit()
    {
        School.Send("report");
    }
}

public class Employee : ICanEnrol, ICanSubmit
{
    public void Enrol()
    {
        Company.Send("enrolment");
    }

    public void Submit()
    {
        Company.Send("report");
    }
}

public class MailServer
{
    public void SendAllSubmissions()
    {
        // AllSubmitters is a collection of students and employees
        foreach (ICanSubmit submitter in AllSubmitters)
        {
            // The MailServer does not care if 
            // the submitter is a student
            // or an employee, as long as it can submit
            submitter.Submit()
        }
    }
}

Why use abstract class and not interface?

Class which provides some of the functionality required by derived classes, but each derived class additionally requires differing implementation of other functionality, then an abstract class provides a means of defining the common implementation, while leaving the specific behaviors required by derived classes to be made specific to each derived class. 

You can not extends more than one class but you can implements more than one interface

Abstract Class

  • Allows you to leverage the power of using constructors and constructor overriding
  • Restrict the class having multiple inheritance(This is particularly useful if you are designing a complicated API)
  • Instance variables and method implementations
  • Leverage the power of method super calling(Use super to call the parent abstract class's implementation)

Interface

  • Enables multiple inheritance - you can implement n number of interfaces
  • Allows to represent only conceptual methods (No method bodies)
Abstract classes do have a few advantages:
  • they allow you to specify abstract methods with package/protected modifiers
  • they facilitate code re-use
  • via the use of abstract methods and final methods on the super class they allow you to restrict the manner in which your class is subclassed, which can be useful in a wide variety of circumstances
  • code that references classes is generally easier to follow in an IDE (clicking "open declaration" on an abstract class type parameter is usually more useful than on an interface type parameter)

Generally use Interfaces for '-able' clause(as in functionality). Eg:-
  1. Runnable
  2. Observable
Use abstract classes for something like is-a(evolution format). Eg:-
  1. Number
  2. Graphics

Friday, 11 October 2013

Biggest of 3 numbers using conditional operator witout using && || !=


Program
---------
import java.util.Scanner;
class demo
{
public static void main(String args[])
{
Scanner s=new Scanner(System.in);
int a,b,c,big;
System.out.println("Enter 3 numbers");
a=s.nextInt();
b=s.nextInt();
c=s.nextInt();
big= a>b ? (a>c ? a : c) : (b>c ? b : c);
System.out.println(big);
}
}

Amicable Numbers Program

Amicable number are pairs of numbers each of whose divisors add to the other
number


Example 
------------
import java.util.Scanner;
class Amicable
{
public static void main(String args[])
{
Scanner s=new Scanner(System.in);
int i,j,n,sum_i=0,sum_j=0; 
System.out.println("Enter 2 Numbers");
i=s.nextInt();
j=s.nextInt();
for(n=1;n<i;n++)
{
if(i%n==0)
sum_i += n;
}
for(n=1;n<j;n++)
{
if(j%n==0)
sum_j += n;
}
if( (sum_j == i)&& (sum_i==j))
System.out.println("Amicable");
else
System.out.println("Not Amicable");
}
}


 

Tuesday, 8 October 2013

Thread

A THREAD is a single sequential flow of control within a program. 

  •  All Java programs have at least one thread, known as the main thread, which is created by the JVM at the program’s start, when the main() method is invoked with the main thread
PROCESS vs THREAD

A process runs independently and isolated of other processes. It cannot directly access shared data in other processes. The resources of the process, e.g. memory and CPU time, are allocated to it via the operating system.
A thread is a so called lightweight process. It has its own call stack but can access shared data of other threads in the same process. Every thread has its own memory cache. If a thread reads shared data it stores this data in its own memory cache. A thread can re-read the shared data.

Example:

The HotJava Web browser is an example of a multithreaded application. Within the HotJava browser you can scroll a page while it's downloading an applet or image, play animation and sound concurrently, print a page in the background while you download a new page, or watch three sorting algorithms race to the finish.


How to Create a Thread!

  1. creating a thread is accomplished by implementing an interface and extending a class. 
  2. Every Java thread is created and controlled by the java.lang.Thread class. 
  3. When a thread is created, it is assigned a priority. 
  4. The thread with higher priority is executed first, followed by lower-priority threads.
The JVM stops executing threads under either of the following conditions:

  • If the exit method has been invoked and authorized by the security manager.
  • All the daemon threads of the program have died.
Types

Multithread
Java is a multithreaded application that allows multiple thread execution at any particular time.
Single Thread
In a single-threaded application, only one thread is executed at a time because the application or program can handle only one task at a time. 

Properties

  • Thread id
  • Each thread has a unique ID (int value) which is provided by either the runtime or the OS; this is very helpful when you want to get the actual reference by.
  • Thread name
  • A name for the thread, it could be the same through many threads, also could be empty. It's useful to categorize threads belonging to a specific module or task.
  • Thread State
  • The current state of the thread. The state of a thread is determined by the State enumeration, and a thread state could be one of the following:
  1. Runnable: indicates that the thread has started and is running its task.
  2. New: indicates the thread has been created, but hasn't invoked (started) yet; when you just create an instance of the thread and haven't attempted invoke the start().
  3. Blocked: when a thread is in running state and is blocked because it is waiting for locking a resource which has been locked by another thread.
  4. Waiting: when the thread is idle and is waiting for a signal (notify).
  5. Timed_Waiting: when the thread is sleeping for an amount of time or is waiting for a signal from any another thread with timeout.
  6. Terminated: when a thread either has finished its job, note that a terminated thread would not start over from the beginning, and it's ready for finalizing.
  7. Interrupted: this indicates if an interrupt signal has been sent to the thread or not, note that this is not an actual state, a thread would get interrupted when it's in either running or waiting states (not in new and terminated states). You cannot get the interrupt state by the State enumeration.
  8. Dead: when thread A is waiting for a signal from thread B, where thread B is waiting for thread A too, or maybe thread B has sent the signal just before thread A attempts to wait for it (this is the actual dead lock), here there is nothing left behind to signal the waiting thread. You need to just program your application in such a way that you ensure there is no dead state. Note that there is no property or method to determine if a thread is in dead state or not.
  •  Thread Priority

    It indicates the priority of the thread, a higher priority causes more process attention (context switch) to the thread, that could be one of the following:
    • MAX_PRIORITY
    • MIN_PRIORITY
    • NORM_PRIORITY (default value)
 Daemon mode:
this one is used for setting that a thread should run in Daemon (background) mode or not. When a thread is in daemon mode, it means it runs until any other user thread (non-daemon) is alive in the application. Whenever there is no user-thread alive, then JVM kills the daemon threads by force (silently). You cannot even get any exception about the exit signal. These kinds of threads are useful when your application needs to have a background-service thread or an event-handler. These threads are usually run in lower priority. Once again, these threads are running within your process, but JVM does not look at them as user threads for checking the life of the process

Thread's Behaviors

  • Start (simultaneously): when the thread needs to run simultaneously with another thread(s), this operation is done by the thread start() method.
  • Sleep: whenever a thread needs to sleep for a particular of time Thread.sleep(time in ms) would help, note that there is no warranty about the exact time, it could get more, the sleep process (reminded time) could get skipped if another thread Interrupts the sleeping thread.
  • Interrupt: it's used when a thread needs to interrupt another thread where it is in either wait (and join()), sleep, or even runnable states. For example, thread A is waiting for a signal, then thread B interrupts thread A, here the interrupt message:
    1. wakes up the target thread if it's either in wait (wait/join) or sleep state
    2. throws InterruptedException to the target thread to notify it about the interrupt signal
    3. sets the interrupted flag to true if and only if the thread was in running state.
      Note that when a thread is in sleep, join, and wait states:
  1. every sleep, join, or wait operation should be surrounded with a try-catch block because of any interruption signal (exception)
  2. the interruption is just like a signal, it doesn't force the thread to shutdown
  •  Getting the current thread: you would access the current thread by Thread.currentThread(). It returns a reference to the currently executing thread object, but outside the thread you may need to check all the threads or have a references of the thread.
  • Join: it means as it says, when thread A joins thread B, it means thread A has to wait until thread B is finished (termination).
  • Yield: a thread calls yield it means the OS can switch to another thread but the first thread still needs to work. 
  • wait()

    It releases the synchronized (locked) object, and waits until another thread notifies (notify, stop, or interrupt) it, then after it gets notified (if by notify) tries to acquire the lock again and continues its work. Note that a waiting thread has to acquire its lock again on the related object.

    sleep()

    ID doesn't release any locked object, and sleeps for a specified amount of time, it could get canceled (wake up) by either stop or interrupt signals.

Tuesday, 1 October 2013

Computing Technology

Different types of computing --

Grid, Cloud, Utility, Distributed and Cluster computing

Cloud Computing 
  • Cloud computing is a computing paradigm shift where computing is moved away from personal computers or an individual application server to a “cloud” of computers. Users of the cloud only need to be concerned with the computing service being asked for, as the underlying details of how it is achieved are hidden. This method of distributed computing is done through pooling all computer resources together and being managed by software rather than a human.
  • The services being requested of a cloud are not limited to using web applications, but can also be IT management tasks such as requesting of systems, a software stack or a specific web appliance.


Grid Computing 
  • Multiple independent computing clusters which act like a “grid” because they are composed of resource nodes not located within a single administrative domain. (formal)
  • Offering online computation or storage as a metered commercial service, known as utility computing, computing on demand, or cloud computing.
  • The creation of a “virtual supercomputer” by using spare computing resources within an organization.


 Utility Computing
  • Conventional Internet hosting services have the capability to quickly arrange for the rental of individual servers, for example to provision a bank of web servers to accommodate a sudden surge in traffic to a web site.
  • “Utility computing” usually envisions some form of virtualization so that the amount of storage or computing power available is considerably larger than that of a single time-sharing computer. Multiple servers are used on the “back end” to make this possible. These might be a dedicated computer cluster specifically built for the purpose of being rented out, or even an under-utilized supercomputer. The technique of running a single calculation on multiple computers is known as distributed computing.


Distributed Computing 
  • A method of computer processing in which different parts of a program are run simultaneously on two or more computers that are communicating with each other over a network. Distributed computing is a type of segmented or parallel computing, but the latter term is most commonly used to refer to processing in which different parts of a program run simultaneously on two or more processors that are part of the same computer. While both types of processing require that a program be segmented—divided into sections that can run simultaneously, distributed computing also requires that the division of the program take into account the different environments on which the different sections of the program will be running. For example, two computers are likely to have different file systems and different hardware components.



Cluster Computing 
  • A computer cluster is a group of linked computers, working together closely so that in many respects they form a single computer. The components of a cluster are commonly, but not always, connected to each other through fast local area networks. Clusters are usually deployed to improve performance and/or availability over that provided by a single computer, while typically being much more cost-effective than single computers of comparable speed or availability. 

Web Services

Web Services can convert your applications into Web-applications.

A web service is a method of communication between two electronic devices over the World Wide Web. A web service is a software function provided at a network address over the web or the cloud; it is a service that is "always on" as in the concept of utility computing.

  • Web services are application components
  • Web services communicate using open protocols
  • Web services are self-contained and self-describing
  • Web services can be discovered using UDDI
  • Web services can be used by other applications
  • XML is the basis for Web services

The basic Web services platform is XML + HTTP.
XML provides a language which can be used between different platforms and programming languages and still express complex messages and functions.

The HTTP protocol is the most used Internet protocol.

Web services platform elements:
  • SOAP (Simple Object Access Protocol)
  • UDDI (Universal Description, Discovery and Integration)
  • WSDL (Web Services Description Language)
 Uses
  1. Reusable application-components.
  2. Connect existing software. 

Saturday, 28 September 2013

Android

Androidis a Linux-based operating system designed primarily for touchscreen mobile devices such as smartphones and tablet computers.
The first Android-powered phone was sold in October 2008

                                            Android Versions

Cupcake:

Right from the start, Android is an open OS that can run almost any app or widget so you can do what you want to do
  • Android 1.5
Donut:

The world's information is at your fingertips - search the web, get driving directions...or watch videos 
  • Android 1.6
Eclair:

Make your home screen just how you want it. Arrange apps and widgets across multiple screens and in folders. Stunning live wallpapers respond to your touch. 
  • Android 2.0
  • Android 2.1
Froyo: (short for "frozen yogurt")

Voice Typing lets you input text, and Voice Actions let you control your phone, just by speaking. 
  • Android 2.2
Gingerbread:

New sensors make Android great for gaming - so you can touch, tap, tilt, and play away. 
  • Android 2.3
Honeycomb:

Optimized for tablets, this release opens up new horizons wherever you are.
  • Android 3.0
  • Android 3.1
  • Android 3.2
Ice Cream Sandwich:

Android comes of age with a new, refined design. Simple, beautiful and beyond smart. 
  • Android 4.0
Jelly Bean:

Android is fast and smooth with buttery graphics. With Google Now, you get just the right information at the right time.

And with more than 1 million apps on Google Play, and thousands of Android devices, you've got the freedom to do what you want on any device you choose. 

  • Android 4.1
  • Android 4.2
  • Android 4.3
KitKat:
With Android KitKat to make an amazing Android experience available for everybody. 
  •  Android 4.4 

Thursday, 26 September 2013

Derby Database

Apache Derby (previously distributed as IBM Cloudscape) is a relational database management system (RDBMS) developed by the Apache Software Foundation that can be embedded in Java programs and used for online transaction processing.
key advantages include:
  • Derby has a small footprint -- about 2.6 megabytes for the base engine and embedded JDBC driver.
  • Derby is based on the Java, JDBC, and SQL standards.
  • Derby provides an embedded JDBC driver that lets you embed Derby in any Java-based solution.
  • Derby also supports the more familiar client/server mode with the Derby Network Client JDBC driver and Derby Network Server.
  • Derby is easy to install, deploy, and use.

Model View Controller

MVC stands for Model-View-Controller. It’s a way of designing an application that separates data access, business logic and the graphical user interface. The goal is to make the application more maintainable.
The Model refers to the data and how it is handled,
the View presents the data to the user and
the Controller interprets the user’s interactions with the View into changes to the Model. 

Wednesday, 25 September 2013

Java (Java ARchive)

JAR (Java ARchive) is an archive file format typically used to aggregate many Java class files and associated metadata and resources (text, images and so on) into one file to distribute application software or libraries on the Java platform.
JAR files are built on the ZIP file format and have the .jar file extension.
Computer users can create or extract JAR files using the jar command that comes with a JDK.
An executable Java program can be packaged in a JAR file, along with any libraries the program uses.
Several related file formats build on the JAR format:
  • WAR (Web application archive) files, also Java archives, store XML files, Java classes, JavaServer Pages and other objects for Web Applications.
  • RAR (resource adapter archive) files (not to be confused with the RAR file format), also Java archives, store XML files, Java classes and other objects for J2EE Connector Architecture (JCA) applications.
  • EAR (enterprise archive) files provide composite Java archives which combine XML files, Java classes and other objects including JAR, WAR and RAR Java archive files for Enterprise Applications.
  • SAR (service archive) is similar to EAR. It provides a service.xml file and accompanying JAR files.
  • APK (Android Application Package), a variant of the Java archive format, is used for Android applications

Java Runtime Environment

The JRE is the software required to run any application deployed on the Java Platform.
End-users commonly use a JRE in software packages and Web browser plugins.
Sun also distributes a superset of the JRE called the Java 2 SDK (more commonly known as the JDK), which includes development tools such as the Java compiler, Javadoc, and debugger.

J2EE (Java 2 Platform, Enterprise Edition)

J2EE (Java 2 Platform, Enterprise Edition) is a Java platform designed for the mainframe-scale computing typical of large enterprises.
J2EE includes many components of the Java 2 Platform, Standard Edition (J2SE):
  • The Java Development Kit (JDK) is included as the core language package.
  • Write Once Run Anywhere technology is included to ensure portability.
  • Support is provided for Common Object Request Broker Architecture (CORBA), a predecessor of Enterprise JavaBeans (EJB), so that Java objects can communicate with CORBA objects both locally and over a network through its interface broker.
  • Java Database Connectivity 2.0 (JDBC), the Java equivalent to Open Database Connectivity (ODBC), is included as the standard interface for Java databases.
  • A security model is included to protect data both locally and in Web-based applications.
J2EE also includes a number of components added to the J2SE model, such as the following:
  • Full support is included for Enterprise JavaBeans. EJB is a server-based technology for the delivery of program components in an enterprise environment. It supports the Extensible Markup Language (XML) and has enhanced deployment and security features.
  • The Java servlet API (application programming interface) enhances consistency for developers without requiring a graphical user interface (GUI).
  • Java Server Pages (JSP) is the Java equivalent to Microsoft's Active Server Pages (ASP) and is used for dynamic Web-enabled data access and manipulation.
The J2EE architecture consists of four major elements:
  • The J2EE Application Programming Model is the standard programming model used to facilitate the development of multi-tier, thin client applications.
  • The J2EE Platform includes necessary policies and APIs such as the Java servlets and Java Message Service (JMS).
  • The J2EE Compatibility Test Suite ensures that J2EE products are compatible with the platform standards.
  • The J2EE Reference Implementation explains J2EE capabilities and provides its operational definition.

Tuesday, 24 September 2013

Major release versions of Java, along with their release dates:
  • JDK 1.0 (January 21, 1996)
  • JDK 1.1 (February 19, 1997)
  • J2SE 1.2 (December 8, 1998)
  • J2SE 1.3 (May 8, 2000)
  • J2SE 1.4 (February 6, 2002)
  • J2SE 5.0 (September 30, 2004)
  • Java SE 6 (December 11, 2006)
  • Java SE 7 (July 28, 2011)