Java Virtual Machine
JAVA VIRTUAL MACHINE:
As we know that all programming language compilers convert the source code to machine code.Same job done by Java Compiler to run a Java program, but the difference is that Java compiler convert the source code into Intermediate code is called as bytecode. This machine is called the Java Virtual machine and it exits only inside the computer memory.
Following figure shows the process of compilation.
The Virtual machine code is not machine specific. The machine specific code is generated. By Java interpreter by acting as an intermediary between the virtual machine and real machines shown below
Java Object Framework act as the intermediary between the user programs and the virtual machine which in turn act as the intermediary between the operating system and the Java Object Framework.
JAVA ENVIRONMENT:
Java environment includes a number of development tools, classes and methods. The development tools are part of the system known as Java Development Kit (JDK) and the classes and methods are part of the Java Standard Library (JSL), also known as the Application Programming Interface (API).
Java Development kit (JDK) – The JDK comes with a set of tools that are used for developing and running Java program. It includes:
- Appletviewer( It is used for viewing the applet)
- Javac(It is a Java Compiler)
- Java(It is a java interpreter)
- Javap(Java diassembler,which convert byte code into program description)
- Javah(It is for java C header files)
- Javadoc(It is for creating HTML document)
For compiling and running the program we have to use following commands:
Syntax
javac (Java compiler)
In java, we can use any text editor for writing program and then save that program with “.java” extension. Java compiler convert the source code or program in bytecode and interpreter convert “.java” file in “.class” file.
Syntax
C:\javac filename.java
If my filename is “abc.java” then the syntax will beC:\javac abc.java
Syntax
java(Java Interpreter)
As we learn that, we can use any text editor for writing program and then save that program with “.java” extension. Java compiler convert the source code or program in bytecode and interpreter convert “.java” file in “.class” file.
Syntax
//Syntax:
C:\java filename
If my filename is abc.java then the syntax will be C:\java abc