Java virtual machine (JVM) - In what language JVM coded?
Is JVM software based? If s开发者_StackOverflow社区o in which language is JVM coded?
Almost all JVMs are implemented in software. However, a JVM is anything that interprets Java bytecode in a manner that complies with the JVM specification, and there are some hardware-based JVMs as well.
Java Virtual Machine is a formal specification for how a virtual machine needs to behave by interpreting bytecode as instructions in the virtual machine's operation set.
If there's some mechanism that interprets the bytecode and behaves the right way, it is a JVM, no matter how it's implemented.
That means a JVM can be implemented in a program, or it can equally well be implemented in hardware. If you want to know which is the case, you need to be talking about some specific implementation.
Kind of... it's more like a standard that has resulted in a number of pieces of software. You cannot be 100% certain what language the JVM is written in, but in most cases, I'd bet it was written in C/C++.
To answer what I think is your question, the JVM is written in C++. The majority of the Java libraries are written in Java, however.
Same applies to .NET: The code CLR/VM is written in C++, but the class libs are written in C#.
JVM stands for "Java Virtual Machine". It's a virtualised environment that provides Java applications with a way of running in the same way across multiple different physical environments.
The idea is that Java code is compiled and is executed by the JVM. The JVM provides the same look and feel for the actual code regardless of whether it's being run on a massively parallel mainframe or a single processor PC running Windows XP.
These days the JVM is being used for languages other than Java (Scala, for example).
JVM is a specification that provides runtime environment in which java bytecode can be executed.
Jvm Interprets your bytecode into Machine Understandable code.
The JVM performs following operation:
- Loads code
- Verifies code
- Executes code
- Provides runtime environment
To do this a code has to be written,
So Implementation of specifications is done here(sun provides mostly).
This implemetation is JRE.
JVM ALSO TELL HOW FOLLOWING THINGS MUST HAPPEN:
- Memory area
- Class file format
- Register set
- Garbage-collected heap
- Fatal error reporting etc.
So This all is Software,find detail working Here JVM Details
The Java Virtual Machine is a program whose purpose is to execute other programs.
The JVM has two primary functions: to allow Java programs to run on any device or operating system (known as the "Write once, run anywhere" principle), and to manage and optimize program memory. When Java was released in 1995, all computer programs were written to a specific operating system, and program memory was managed by the software developer.
JVM is a software specification. In a somewhat circular fashion, the JVM spec highlights that its implementation details are not defined within the spec, in order to allow for maximum creativity in its realization.
So, all the JVM has to do is run Java programs correctly. Sounds simple, might even look simple from outside, but it is a massive undertaking, especially given the power and flexibility of the Java language.
Check out the article to learn more about JVM.
精彩评论