Wednesday, February 8, 2012

Getting started with Java

Overview of the Java Language:
1.       The Java 2 platform
2.       Executing Java programs
3.       Summary
The Java 2 platform
Java is a high-level, object-oriented programming language that allows developers to build applications that can run without modifications on many hardware platforms and operating systems.
Sun Microsystems designed Java to be both simpler for developers to use than other existing high-level programming languages and capable of producing complex, high-performance networked applications.
Java is both a programming language and a platform.
The Java language specification defines all the rules for writing programs in Java.
The Java platform is the underlying system on which Java applications run.
It also provides several additional tools for developing Java applications.
The Java platform defines the standard around which Java systems can be developed.
The core Java platform is the Java 2 Platform, Standard Edition or J2Se. And the current version of the J2SE platform is 1.4.
At the foundation of the J2SE 2 platform is the Java Runtime Environment (JRE). The JRE runs the applications and applets coded in Java on a variety of platforms.
                The JRE consists of:
·         The Java Virtual Machine (JVM)
o   The Java Virtual Machine (JVM) is the part of the Java platform that ensure Java’s platform independence. It interprets compiled Java code and allows it to run on a specific operating System.
o   The JVM is a Java interpreter and there is an implementation of it for each particular hardware and operating system platform.
o   The JVM can be implemented in both hardware and software.
·         The J2SE application programming interface (API)
o   The J2SE API is a collection of software that provides ready-made functionality for your programs. The software is grouped into libraries of related components, such as graphics, security, and networking.
o   Programs written in the Java language can access API functionality.
o   The Java API also includes the components that you use to create applets – small Java applications that you include in web pages and run using a browser’s own implementation of the Java Virtual Machine (JVM).
The second major component of the J2SE is the Java 2 Software Development Kit (SDK).
It Contains the JRE along with several other tools for developing Java applications and applets. These tools include the Java complier and debugger.
As well as the J2SE platform, Sun has developed two other Java plarforms:
·         Java 2 Platform, Enterprise Edition (J2EE)
o   The J2EE includes the core functionality of the J2SE, and several additional features, which make it suitable for developing multi-tier enterprise applications that can run over corporate networks and the internet.
·         The J2ME is used to developed applications for end-user devices, such as mobile phones and Personal Digital Assistants (PDAs). The J2ME consists of stripped-down JVM and a small set of class libraries. A number of optional packages allow developers to implement Java applications in a variety of devices while writing the program onlt once. This is aided by dynamic downloads.

Executing Java programs
The first step in creating a Java application is writing the Java source code in a text editor.
Before you can run the Java program that you have created, you need to compile it. You can do this using any machine that has a Java compiler installed.
A Java compiler compiles the code into Java bytecode which is stored in a file known as a Java class file. Bytecode is platform independent code.
Once the Java code is in a bytecode format it can be interpreted and run by the JVM, so there is no need to rewrite or recompile the program for different platforms or operating systems.
Originally the JVM interpreted and executed the Java bytecode itself. Because of this, Java programs could run at a slower rate than programs compiled in native code.
However, the Java 2 platform uses a just in time (JIT) compiler which significantly improves Java’s performance. This is because it dynamically translates the bytecode to native machine code as it interprets it, so it can execute on the machine’s processor.
In addition, Sun has introduced the Java HotSpot Performance Engine, which greatly improves Java code efficiently. As a result, performance is no longer a major concern for Java developers.

Summary
Java is a high-level, object-oriented programming language designed by Sun Microsystems to allow developers to build applications that can run on any hardware platform or operating system. The Java 2 Platform, Standard Edition 5.0 is the latest version of Java platform. It consists of the Java Runtime Environment (JRE) and the Java 2 Software Development Kit (SDK). The JRE contains the Java Virtual Machine (JVM) and the J2SE application programming Interface (API).
Java programs are first compiled into Java bytecode, which is then interpreted and executed by a Java interpreter or JVM at runtime.



0 comments:

Post a Comment