sourcecodematrix

A fine WordPress.com site

Java Programming Language and Java Software Platform

By Luis Mtz

Java refers to a Programming Language, and to a Software Platform.

The following article will help to understand  both Java concepts.

Compiler

Early software for computers was written in assembly language.  High-Level languages made programming easier than assembly language, but, since CPUs speaks the assembly language, some form of translation between High-Level languages to Assembly Language was needed, thus, the compiler.

The compiler is a program that translates a High-Level language to machine code, creating a new file with a different file extension (tipycally, .lib or .obj), and whose language is machine code. This language is called Object Code.

Another program joins different object files generated by the compiler, and link them together in an executable file (.com or .exe). This program is called linker.

Interpreter

An interpreter does very much the same thing, the difference being that it translates and executes every time the code is executed:

Script

In computer programming, a script is a program or sequence of instructions that is interpreted or carried out by another program rather than by the computer processor (as a compiled program is).

In general, script languages are easier and faster to code in than the more structured and compiled languages such as C and C++. However, a script takes longer to run than a compiled program since each instruction is being handled by another program first (requiring additional instructions) rather than directly by the basic instruction processor set.

Virtual Machine

A virtual machine (VM) is a software implementation of a computing environment in which an operating system (OS) or program can be installed and run.

The virtual machine typically emulates a physical computing environment, but requests for CPU, memory, hard disk, network and other hardware resources are managed by a virtualization layer which translates these requests to the underlying physical hardware.

Bytecode

Bytecode is computer object code that is processed by a program, usually referred to as a virtual machine, rather than by the “real” computer machine, the hardware processor. The virtual machine converts each generalized machine instruction into a specific machine instruction or instructions that this computer’s processor will understand. Bytecode is the result of compiling source code written in a language that supports this approach. Most computer languages, such as C and C++, require a separate compiler for each computer platform – that is, for each computer operating system and the hardware set of instructions that it is built on. Windows and the Intel line of microprocessor architectures are one platform; Apple and the PowerPC processors are another. Using a language that comes with a virtual machine for each platform, your source language statements need to be compiled only once and will then run on any platform.

The best-known language today that uses the bytecode and virtual machine approach is Java.

Rather than being interpreted one instruction at a time, Java bytecode can be recompiled at each particular system platform by a just-in-time compiler (A JIT compiler loads the bytecode in memory, and compiles the instruction that is to be executed). Usually, this will enable the Java program to run faster. In Java, bytecode is contained in a binary file with a .CLASS suffix.

The Java Programming Language

In the Java programming language, all source code is first written in plain text files ending with the .java extension. Those source files are then compiled into .class files by the javac compiler. A .class file does not contain code that is native to your processor; it instead contains bytecodes — the machine language of the Java Virtual Machine (Java VM). The java launcher tool then runs your application with an instance of the Java Virtual Machine.

The Java PlatformA platform is the hardware or software environment in which a program runs. Some of the most popular platforms are Microsoft Windows, Linux, Solaris OS, and Mac OS. Most platforms can be described as a combination of the operating system and underlying hardware. The Java platform differs from most other platforms in that it’s a software-only platform that runs on top of other hardware-based platforms.

The Java platform has two components:

  • The Java Virtual Machine (JVM)
  • The Java Application Programming Interface (API)

The Java Virtual Machine is the base for the Java platform and is ported onto various hardware-based platforms.

The API is a large collection of ready-made software components that provide many useful capabilities. It is grouped into libraries of related classes and interfaces; these libraries are known as packages.

The API and Java Virtual Machine insulate the program from the underlying hardware.

As a platform-independent environment, the Java platform can be a bit slower than native code. However, advances in compiler and virtual machine technologies are bringing performance close to that of native code without threatening portability.

Next Post: JDK, JVM, JRE, JAVAC, JAR: Java

Sources and References:

http://warleo.com/blog/?p=49

http://docs.oracle.com/javase/tutorial/getStarted/intro/definition.html

http://www.griffincaprio.com/blog/2006/08/virtual-machines-virtualization-vs-emulation.html

http://en.wikipedia.org/wiki/Virtual_machine

http://searchcio-midmarket.techtarget.com/definition/bytecode

http://warleo.com/blog/?p=49

 http://www.oracle.com/technetwork/java/langenv-140151.html

http://docs.oracle.com/javase/tutorial/getStarted/intro/definition.html

http://en.wikipedia.org/wiki/Linker_(computing)

One comment on “Java Programming Language and Java Software Platform

  1. Pingback: JDK, JVM, JRE, JAVAC, JAR: Java « sourcecodematrix

Leave a comment

Information

This entry was posted on February 2, 2013 by in JAVA and tagged , , , , , , , , , , , , .