Compiler vs Interpreter

Hi, I understand that JVM comes with interpreter and advanced version comes with compiler. I need a clear cut difference between the functionalities of both ( compiler and Interpreter). If older version uses interpreter, what is the need to move on to JVM with Compilers. Which is advantageous, why?..what are the operations of both?.

thanks.
nmretdAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

StillUnAwareCommented:
There are two main Java releases:
  Java Runtime Environment - allows running java applications and applets.
  Java Development Kit - allows compiling Java source code to bytecode. Also includes JRE.
0
Tommy BraasCommented:
Like StillUnAware lists, there are two different distributions available for JVMs. One that is purely a runtime environment (JRE), and one which includes developer tools (the JDK).

However, that has nothing to do with your question.

A JVM will execute byte code (which has previously been compiled by a Java compiler) in one of two mode: interpreted or compiled.

Interpreted mode is when the JVM executes the java byte code as java byte code.
Compiled mode is when the JVM has compiled the java byte code to native code such that execution of that code will be at, or near, native code speed.

The main difference between the two is obviously speed. A second difference, which is of importance for developers, is that when the code is interpreted line numbers are preserved and debugging is fairly straight forward. This is not the case for compiled mode. In compiled mode the line numbers are stripped, and this makes it harder to debug.
0
rauf_patsCommented:


  Hi

  In java languge when you write code  .all the code is in java .becos java is a platform independent language all your code need to be compiled  .Complier which comes with Java development kit  JDK compiles the java code in to classes .
 JVM is the run time envirnoment for java applications which should be there on every machine you want to run java application.Jvm converts the  java classes in to the machine language .


Ayoub
0
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

sciuriwareCommented:
As I don't understand the answers given above I'll give my version:

The present JAVA (1.5.0_06) comes in ONE version that has an interpreter
to execute .class files and .jar files and an inbuilt HOTSPOT compiler
to re-compile critical code into machine language.
It is very hard to find out when the second comes into action,
but comparison with ultra-fast C-programs proves that the speed
of java programs is only a fraction slower, so it works!

The difference between the JRE (runtime version) and the JDK (development version)
is only the added source compiler, sources and some tools.

So, why the compiler? To build programs.
Why the interpreter? To run programs.
Why the hotspot compiler? To speed programs up.

;JOOP!
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Tommy BraasCommented:
>> So, why the compiler? To build programs.
Assuming you mean the javac compiler, for the same reasons that you compile regular source code files. To transform the textual representation of a program into a form that the machine can understand. The JVM is a Virtual Machine.

>> Why the interpreter? To run programs.
Yes.

>> Why the hotspot compiler? To speed programs up.
Yes.
0
Tommy BraasCommented:
Btw, I think our answers deserve more than a grade B.
0
sciuriwareCommented:
orangehead911, read at Matthew 20:1-16 .....................

;St.John!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.