This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes Product and Other Certifications and the fly likes JVM Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Certification » Product and Other Certifications
Bookmark "JVM" Watch "JVM" New topic
Author

JVM

Ramesh Kumar Swarnkar
Ranch Hand

Joined: Sep 15, 2003
Posts: 84
Hi,
If in one system I have two separate consoles and compiling/running separate Java classes into each console. So Can I say that I am working in two separate JVM (assume I have onely one version of JDK and JRE is installed in my system and its path is set in 'System variable')?

Let me put the question in another way :
As many number of consoles I open in a single system to compile and run multiple Java programs, at any instance of time, can I say that many number of JVMs are running on my system ?
Jan Cumps
Bartender

Joined: Dec 20, 2006
Posts: 2504
    
    8

Yes.


OCUP UML fundamental and ITIL foundation
youtube channel
Tiwari Gaurav
Greenhorn

Joined: Oct 04, 2007
Posts: 1
I think there would be a single JVM as the System variable is pointing to same JRE path.Its not dependent on number of consoles being opened.If you want to have more than one JVM on your system , set 2 different paths for JAVA_HOME , through each console and then run your program.

Regards,
Gaurav
Ramesh Kumar Swarnkar
Ranch Hand

Joined: Sep 15, 2003
Posts: 84
Yes Gaurav, I think this is what I had have assuming................
But I am confused with Jan's reply. Jan can you please elaborate it.

If any body can point more light on it ?

Thanks in advance....
Ramesh Kumar Swarnkar
Ranch Hand

Joined: Sep 15, 2003
Posts: 84
As we know JRE is responsible to provide JVM, as many consoles we open to run different classes, we can say that many INSTANCES of JVM get creates. That means we have multiple INSTANCES of ONE JVM.
And each instance of JVM may have separate algorithm for garbage collection and thread-scheduling.

So, My conclusion is:
There would be only one JVM; but would be working in Multiple instances(Objects) of ONE JVM.
Finally, instances are nothing but Objects only, which are responsible to simulate. Hence we can say Multiple JVM exist

Let us give a look to this link:
http://www.artima.com/insidejvm/ed2/jvm.html
ready carefull the heading The Lifetime of a Java Virtual Machine, specially 1st and 8th paragraphs.

Thanks Jan and Gaurav.

[ June 05, 2008: Message edited by: Ramesh Kumar Swarnkar ]
[ June 05, 2008: Message edited by: Ramesh Kumar Swarnkar ]
Jan Cumps
Bartender

Joined: Dec 20, 2006
Posts: 2504
    
    8

But I am confused with Jan's reply. Jan can you please elaborate it.
If you define a java virtual machine as an environment that runs java code, then you will have two virtual machines running at the same time (and yes, they are both instanes of the same jre installed on the computer). But the machine actively runs two java virtual machines.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JVM