• 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

 
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ?
 
Bartender
Posts: 2661
19
Netbeans IDE C++ Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes.
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 89
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 89
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 2661
19
Netbeans IDE C++ Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic