• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Interpreter

 
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What is the difference between JVM and Interpreter?
Does Interpreter converts the .class file to .exe and gives it to the processor?If so what is JVM doing?
Is true that JVM and Interpreter are same?
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The JVM is an interpreter for Java byte code. It reads the byte code and executes the instructions.

That's the general principle, but in practice it's a bit more complicated. In order to make Java programs run faster, the JVM calls the JIT (Just In Time) compiler to convert the Java byte code of frequently used pieces of code into native machine instructions, so that it doesn't have to interpret the byte code every time that piece of code is executed.
 
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The term "interpreter" has a much more general meaning than what is discussed here. Typically, an "interpreter" is an option that can be used instead of a "compiler". An interpreter differs from a compiler in that it "interprets" the commands into binary code that the computer unsterstands as the program runs. This means that every time you run a program, the interpreter needs to change the commands into so-called "native code". On the other hand, a compiler converts the program into native code once when it is compiled. Then when you run the program, the native code is run directly; there is no intermediate interpretting step.

These two options have their advantages and disadvantages. Compiling code takes extra time when you are developing and testing software. Interpreting code takes more time when it is run. There are other trade offs, but these are the primary two, in my opinion.

Layne
 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Interpreter: An interpreter is a computer program that executes other programs. This is in contrast to a compiler which does not execute its input program (the source code) but translates it into executable machine code (also called object code) which is output to a file for later execution. It may be possible to execute the same source code either directly by an interpreter or by compiling it and then executing the machine code produced.

Java Virtual Machine. An abstract computing machine, or virtual machine, JVM is a platform-independent programming language that converts Java bytecode into machine language and executes it. Most programming languages compile source code directly into machine code that is designed to run on a specific microprocessor architecture or operating system, such as Windows or UNIX. A JVM -- a machine within a machine -- mimics a real Java processor, enabling Java bytecode to be executed as actions or operating system calls on any processor regardless of the operating system. For example, establishing a socket connection from a workstation to a remote machine

--------------
Naveen Vooka
www.devsquare.com
DevSquare - Online Application Development
 
A lot of people cry when they cut onions. The trick is not to form an emotional bond. This tiny ad told me:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic