简体   繁体   English

JVM 和 OS 解释器之间的区别?

[英]Difference between JVM and OS Interpreter?

I want to know what is the difference between java interpreter(JVM) and OS interpreter(Command Interpreter)?我想知道 java 解释器(JVM)和操作系统解释器(命令解释器)有什么区别?

So here is the difference what you are looking for.因此,这就是您要寻找的差异。

CLI Interpreter The CLI interpreter has different syntaxes for different operating system. CLI 解释器CLI 解释器针对不同的操作系统有不同的语法。 It normally is used to run other programs, and only a small amount of time is actually spent in processing the CLI statements.它通常用于运行其他程序,实际上只花费很少的时间来处理 CLI 语句。

Java Virtual Machine with JVM The Java compiler converts the Java source code into an intermediate form called Java class files. 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. class 文件对于所有操作系统都是相同的。 A great deal of checking for syntax errors and inconsistencies is done while creating the class file.在创建 class 文件时会进行大量语法错误和不一致检查。 The Java interpreter reads and executes the instructions in the class files. Java 解释器读取并执行 class 文件中的指令。

The Just In Time Java interpreter JIT optimizes code that is run frequently, making execution much faster. Just In Time Java 解释器 JIT 优化了频繁运行的代码,使执行速度更快。

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???假设您的意思是命令行界面..或者甚至可能是在 shell 中运行的脚本? Let's assume you mean JVM vs a shell.假设您的意思是 JVM 与 shell。 A shell can be portable.. to an extent, like a VM. shell 可以在一定程度上像 VM 一样便携。 And if that shell sports scripting like bash or equivalent.如果 shell 运动脚本,如 bash 或等效的。 The difference is on many levels.差异在很多层面上。 JVM is a machine interpreter.. more or less an emulator. JVM 是一个机器解释器.. 或多或少是一个模拟器。 A shell is just an interpreter. shell 只是一个解释器。 That is to say, Java is compiled code running on emulation machine;也就是说,Java是在仿真机上运行的编译代码; a shell script is an interpreter running realtime code. shell 脚本是运行实时代码的解释器。 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).在系统级别上,JVM 与解释器的实现是因为 JVM 本质上是一个机器仿真器,它还支持诸如动态重新编译之类的高级技术(它还有其他名称;ZD52387880E1EA21D3817A72虽然没有) 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. JVM 的一部分也可以在硬件中实现,作为硬件/软件解决方案(一些 JVM 字节代码可以在处理器上本地执行) - 解释器通常不能。 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. Java 关注整体速度,同时仍保持编译代码的可移植性。 Interpreters are not.口译员不是。 If speed is an issue, it's supplemented with faster-compiled code (linked libraries.. like C-types).如果速度是一个问题,它会辅以更快的编译代码(链接库......像 C 类型)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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