Java Virtual Machine

Only available on StudyMode
  • Topic: Java, Java Virtual Machine, Virtual machine
  • Pages : 10 (2065 words )
  • Download(s) : 142
  • Published : November 29, 2010
Open Document
Text Preview
Your continued donations keep Wikipedia running!
Java Virtual Machine
From Wikipedia, the free encyclopedia

A Java Virtual Machine (JVM) is a set of computer software programs and data structures that use a virtual machine model for the execution of other computer programs and scripts. The model used by a JVM accepts a form of computer intermediate language commonly referred to as Java bytecode. This language conceptually represents the instruction set of a stack-oriented, capability architecture. As of 2006, there are an estimated four billion JVM-enabled devices worldwide.Contents [hide] 1 Overview

2 Execution environment
3 Support for dynamic languages
4 Bytecode verifier
5 Bytecode instructions
6 Secure execution of remote code
7 C to bytecode compilers
8 Licensing
9 See also
10 Notes
11 References
12 External links

[edit]
Overview

Java Virtual Machines operate on Java bytecode, which is normally (but not necessarily) generated from Java source code; a JVM can also be used to implement programming languages other than Java. For example, Ada source code can be compiled to Java bytecode, which may then be executed by a JVM. JVMs can also be released by other companies besides Sun (the developer of Java) — JVMs using the "Java" trademark may be developed by other companies as long as they adhere to the JVM specification published by Sun (and related contractual obligations).

The JVM is a crucial component of the Java Platform. Because JVMs are available for many hardware and software platforms, Java can be both middleware and a platform in its own right — hence the trademark write once, run anywhere. The use of the same bytecode for all platforms allows Java to be described as "compile once, run anywhere", as opposed to "write once, compile anywhere", which describes cross-platform compiled languages. The JVM also enables such features as Automated Exception Handling that provides 'root-cause' debugging information for every software error (exception) independent of the source code.

The JVM is distributed along with a set of standard class libraries that implement the Java API (Application Programming Interface). An application programming interface is what a computer system, library or application provides in order to allow data exchange between them. They are bundled together as the Java Runtime Environment.

[edit]
Execution environment

Programs intended to run on a JVM must be compiled into a standardized portable binary format, which typically comes in the form of .class files. A program may consist of many classes in different files. For easier distribution of large programs, multiple class files may be packaged together in a .jar file (short for Java archive).

The JVM runtime executes .class or .jar files, emulating the JVM instruction set by interpreting it, or using a just-in-time compiler (JIT) such as Sun's HotSpot. JIT compiling, not interpreting, is used in most JVMs today to achieve greater speed. Ahead-of-time compilers that enable the developer to precompile class files into native code for a particular platforms also exist.

Like most virtual machines, the Java Virtual Machine has a stack-based architecture akin to a microcontroller/microprocessor.

The JVM, which is the instance of the JRE (Java Runtime Environment), comes into action when a Java program is executed. When execution is complete, this instance is garbage-collected. JIT is the part of the JVM that is used to speed up the execution time. JIT compiles parts of the byte code that have similar functionality at the same time, and hence reduces the amount of time needed for compilation.

[edit]
Support for dynamic languages
See also: Da Vinci Machine and List of JVM languages

Although the JVM was primarily aimed at running compiled Java programs, other languages can now run on top of it[1], such as: Ruby, with JRuby
JavaScript, with Rhino
Python, with Jython
Groovy
PHP , with Quercus
Clojure...
tracking img