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

what executes the jvm ??

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i was reading class-loaders from the book "core java 2 vol 2", when i came across the following lines:
"A Java compiler converts source into the machine language of a hypothetical machine, called the virtual machine. The virtual machine code is stored in a class file with a .class extension."
what i have read till now, the instance of the classes i make are run(interpreted) by JVM; but (as stated above) since JVM itself is an instance of a class , what interprets the JVM itself ??

the book further says :
"These class files must be interpreted by a program that can translate the instruction set of the virtual machine into the machine language of the target machine."
what is "a program" here ??

thanks.
 
Marshal
Posts: 79781
382
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"dpux..." please check your private messages about an important administrative matter.
 
Ranch Hand
Posts: 148
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A JVM is not a class file itself, but a program that can be written in C or C++, or any compiled language. When you launch your program using at the command line, you're launching your system's JVM with your class name as an argument. The JVM was provided for your operating environment (probably by Sun, IBM, or an open source distribution) so that you can run programs written in Java.

When Core Java 2 says "The virtual machine code is stored in a class file with a .class extension.", it is referring to the byte code for the classes that you write, not the code for the JVM.

In the second part of your question, "a program" does refer to the JVM.
 
deepak mishra
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks bill.
i got you, just one more query, is it wrong saying that JVM is a process and each time we run a program calling "java xxx" , we create a new JVM ?
if it IS so, then what if we run 10 programs :
java 1
java 2
.
.
java 10

will there be 10 JVMs loaded in the memory as processes ??
 
Campbell Ritchie
Marshal
Posts: 79781
382
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"dpux forlinux" please read your private messages again.
 
Bill Cruise
Ranch Hand
Posts: 148
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, every call to "java xxx" creates a separate process to run a new JVM. These separate JVMs all have their own area of memory and their own call stacks.
 
Liar, liar, pants on fire! refreshing plug:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic