This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes what executes the jvm ?? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "what executes the jvm ??" Watch "what executes the jvm ??" New topic
Author

what executes the jvm ??

deepak mishra
Greenhorn

Joined: Jul 21, 2008
Posts: 6
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.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38513
    
  23
"dpux..." please check your private messages about an important administrative matter.
Bill Cruise
Ranch Hand

Joined: Jun 01, 2007
Posts: 148
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

Joined: Jul 21, 2008
Posts: 6
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
Sheriff

Joined: Oct 13, 2005
Posts: 38513
    
  23
"dpux forlinux" please read your private messages again.
Bill Cruise
Ranch Hand

Joined: Jun 01, 2007
Posts: 148
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: what executes the jvm ??