简体   繁体   中英

Difference between JVM and OS Interpreter?

I want to know what is the difference between java interpreter(JVM) and OS interpreter(Command Interpreter)?

So here is the difference what you are looking for.

CLI Interpreter The CLI interpreter has different syntaxes for different operating system. It normally is used to run other programs, and only a small amount of time is actually spent in processing the CLI statements.

Java Virtual Machine with JVM The Java compiler converts the Java source code into an intermediate form called Java class files. The class files are the same for all operating systems. A great deal of checking for syntax errors and inconsistencies is done while creating the class file. The Java interpreter reads and executes the instructions in the class files.

The Just In Time Java interpreter JIT optimizes code that is run frequently, making execution much faster.

That's more or less asking what's the difference between a tire and a steering wheel. Okay maybe not that drastic, but the question doesn't really make sense to me. Assuming you mean command line interface.. or maybe even a script running in a shell??? Let's assume you mean JVM vs a shell. A shell can be portable.. to an extent, like a VM. And if that shell sports scripting like bash or equivalent. The difference is on many levels. JVM is a machine interpreter.. more or less an emulator. A shell is just an interpreter. That is to say, Java is compiled code running on emulation machine; a shell script is an interpreter running realtime code. Since you only asked about the “interpreters” rather than the languages themselves, their toolsets, capabilities, etc - I'll leave it at that.

On a system level, the implementation of the JVM vs the interpreter is that because the JVM is essentially a machine emulator, it also supports advanced techniques such as dynamic recompiling (which has other names; Java didn't invent it though). Parts of JVM can also be implemented in hardware, as a hardware/software solution (some JVM byte code could be executed natively on a processor) - interpreters generally cannot. That's not to say you couldn't implement dynamic recompiling (code execution mapping: run interpreted code again as native code), but it's going to be more than a straight interpreter at that point. Java is concerned with speed overall, while still maintaining portability of compiled code. Interpreters are not. If speed is an issue, it's supplemented with faster-compiled code (linked libraries.. like C-types).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM