Tuesday, July 19, 2016

JRE,JVM and JDK

Java Tutorial

Java Virtual Machine

The Java Virtual Machine (JVM) is an execution environment for Java applications.
It interprets compiled Java binary code ( called bytecode) to enable a computer's processor to carry out a Java Program's instructions.Java was designed to allow application programs to be built that could be run on any platform without having to be rewritten or recompiled by the programmer for each separate platform. The Java Virtual Machine makes this possible.
  • The JVM is a main component of Java architecture, and is a part of the JRE(Java Runtime Environment).
  • The JVM is operating system-dependent. In other words, the JVM must translate the bytecode into machine language, and the machine language depends on which operating system is being used, which makes the JVM platform-dependent.
  • The JVM is responsible for allocating memory needed by the Java program.

Basically, the Java compiler reads Java language source (.java) files, translates the source into Java bytecodes, and places the bytecodes into class (.class) files.
The class files can then be executed on the Java Virtual Machine(JVM)

The JVM performs following main tasks:
  • Loads code
  • Verifies code
  • Executes code
  • Provides runtime environment

Every device that has a JVM installed is able to translate and run your .class files.
This makes it possible to run the same bytecode on different platforms.


JRE

JRE is an acronym for Java Runtime Environment.It is used to provide runtime environment.It is the implementation of JVM. It physically exists. It contains set of libraries + other files that JVM uses at runtime.
Implementation of JVMs are also actively released by other companies besides Sun Micro Systems.

Java Development Kit(JDK)

The Java Development Kit(JDK) is a software development environment for java applications and applets. It includes

  • The Java Compiler(javac)
  • The Java Archiving Tool(jar)
  • The Java Debugging Tool(jdb)
  • A complete Java Runtime Environment(JRE), for running Java programs.

After installing the JDK, you will be able to run javac,jar and jdb from the console(Command Prompt in Windows).

JDK is available for free at www.oracle.com under Java SDKs and Tools-> Java SE.

No comments :

Post a Comment