Win a copy of Real-World Software Development: A Project-Driven Guide to Fundamentals in Java this week in the Agile and Other Processes forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Liutauras Vilda
  • Knute Snortum
  • Bear Bibeault
Sheriffs:
  • Devaka Cooray
  • Jeanne Boyarsky
  • Junilu Lacar
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • salvin francis
Bartenders:
  • Tim Holloway
  • Piet Souris
  • Frits Walraven

JVM

 
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
  • 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: 2657
19
Netbeans IDE C++ Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes.
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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: 2657
19
Netbeans IDE C++ Linux
  • Mark post as helpful
  • send pies
  • 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.
 
I'd appreciate it if you pronounced my name correctly. Pinhead, with a silent "H". Petite ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!