This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Beginning Java and the fly likes Multiple JVM in same machine Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Multiple JVM in same machine" Watch "Multiple JVM in same machine" New topic
Author

Multiple JVM in same machine

Mohd Fuzail
Ranch Hand

Joined: Feb 20, 2002
Posts: 107
If we run two java application on same machine, will both of them will be having differrent JVM?

If we are having two instances of ecllipse running on same machine, each of them are having their own JVM or they are sharing one JVM ?

Please direct me the link where i can find more information about this issue


Being defeated is often a temporary condition. Giving up is what makes it permanent.
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24183
    
  34

Each instance of the program "java.exe" on Windows is a separate JVM. If you start any two Java-based processes on your computer, they will each be running in their own JVM , whether they be Eclipse or anything else.

Hopefully this is enough information for you; I can't imagine what sort of link would provide any more information than that.

Moving to Java in General (Beginner).


[Jess in Action][AskingGoodQuestions]
Mohd Fuzail
Ranch Hand

Joined: Feb 20, 2002
Posts: 107
Thanks Ernest for the information.

Can provide any online tutorial link or specification which talks in details about multiple JVM
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24183
    
  34

Originally posted by Mohd Fuzail:

Can provide any online tutorial link or specification which talks in details about multiple JVM


If you have some specific question, just ask it, please. But there is no such thing as "an online tutorial about multiple JVM."
Mohd Fuzail
Ranch Hand

Joined: Feb 20, 2002
Posts: 107
I did my SCJP way back in 2001 and i was surprised to know that this multiple JVM issue i never read or encountered till date

So i was wondering if some book or specification talks about each java.exe program invoking and running in it's own JVM

Sorry for streching the issue, but i need to read and go in details about this issue
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24183
    
  34

What issues? What details? What did you expect your SCJP study materials to go into?

If there's some specific question you have, please ask it. But there is no "SCJP Guide to Multiple JVMs" any more than there is an "SCJP Guide to Spelling 'int'." Once you know the answer, you know it -- there's nothing more to it!
fred rosenberger
lowercase baba
Bartender

Joined: Oct 02, 2003
Posts: 11256
    
  16

are you trying to have two different VERSIONS of java on your pc at the same time?

or do you simply want to have two JVMs running at the same time? the second is easy. go to your command prompt and type "java <class>", which will start up a JVM and your program.

then, while that program is running, type "java <class>", and start another program running. this will then start up a second JVM. you will then have two JVMs running until one of your apps shuts down.


There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
Abhineet Kapil
Ranch Hand

Joined: Feb 08, 2010
Posts: 52

Hi,

I have a question on that...


When we need to call a method of ObjectB in Jvm2 from a client ClassA which is in another jvm Jvm1.. We need to use RMI ...

Does the same apply to 2 Jvms running in the same machine and sharing same memory (RAM)..

Can we create sample RMI code and test it on the same machine ??
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38472
    
  23
Two JVMs cannot run and share memory. Each has its own heap, in different areas of RAM.
You would need to use sockets, multiple agents, RMI or similar to access code on different JVMs. You can try it out with two JVMs on the same machine, yes.
Abhineet Kapil
Ranch Hand

Joined: Feb 08, 2010
Posts: 52

Thanks Campbell..

Can you please help with some basic material/link on this subject.

I want to write a simple class object in one jvm calling the method of another object in another jvm .. Both Jvms are on the same machine..

Thanks ..
Jeff Verdegan
Bartender

Joined: Jan 03, 2004
Posts: 6109
    
    6

You could start by googling for something like java rmi tutorial.
Abhineet Kapil
Ranch Hand

Joined: Feb 08, 2010
Posts: 52

Thanks Jeff ..

Will follow that...
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38472
    
  23
Jeff Verdegan wrote:You could start by googling for something like java rmi tutorial.
You might find something here.
 
jQuery in Action, 2nd edition
 
subject: Multiple JVM in same machine