• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JVM ,JTI and Interpreter

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
HI! can anyone explain me what is done exactly once i type
1)javac mypro.java
and later
2) java myporg
It would help me alot if some gives me exact details i.e what are roles played by JVM,JTI and interpreter ? at what times.
Thanks in advance.
Murali
 
Ranch Hand
Posts: 154
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Muralidhar Gandepalli:
HI! can anyone explain me what is done exactly once i type
1)javac mypro.java
and later
2) java myporg
It would help me alot if some gives me exact details i.e what are roles played by JVM,JTI and interpreter ? at what times.
Thanks in advance.
Murali


When you type javac MyProg.java, the java compiler converts your java source file to 'bytecode'. This is the same whatever machine you compile it on (aside from slight differences between compilers).
Then, you run java MyProg. To run your program, the JVM (which is written specifically for the platfor it's running on) reads the bytecode and interprets it, line by line, and works out what to do, passing native (platform-specific) instructions to the processor accordingly.
The JIT (just-in-time) compiler, which is'nt included in all JVMs, is something used to potentially increase performance of a java program. Instead of interpreting the bytecode line by line, when the JVM reads in a bit of code, the JIT compiles it to native machine code. This takes a bit of time, but next time the bit of code is happened upon, there is a native version of it, so it doesn't have to be interpreted and executes faster.
And then it says "hello world!" on your screen.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic