two or more jvm in a single machine

Discussion in 'Java' started by santoshjoshi2003@yahoo.co.in, Mar 8, 2007.

  1. Guest

    hi can there be two JVM in a single machine if yes please provide me
    the details
     
    , Mar 8, 2007
    #1
    1. Advertising

  2. Nigel Wade Guest

    wrote:

    > hi can there be two JVM in a single machine


    Yes.

    > if yes please provide me
    > the details


    What details do you want?
    Each invocation of java creates a new JVM in a completely independent process.

    --
    Nigel Wade, System Administrator, Space Plasma Physics Group,
    University of Leicester, Leicester, LE1 7RH, UK
    E-mail :
    Phone : +44 (0)116 2523548, Fax : +44 (0)116 2523555
     
    Nigel Wade, Mar 8, 2007
    #2
    1. Advertising

  3. Nigel Wade wrote:
    > wrote:
    >
    >> hi can there be two JVM in a single machine

    >
    > Yes.
    >
    >> if yes please provide me
    >> the details

    >
    > What details do you want?
    > Each invocation of java creates a new JVM in a completely independent process.
    >


    Not entirely true. JVMs share memory space, so the same class versions
    and static variables stay constant throughout the computer.
     
    Joshua Cranmer, Mar 8, 2007
    #3
  4. Joshua Cranmer wrote:
    > Nigel Wade wrote:
    >> wrote:
    >>
    >>> hi can there be two JVM in a single machine

    >>
    >> Yes.


    And, in case OP means two JRE or SDK installations,
    also yes.

    >>> if yes please provide me the details

    >>
    >> What details do you want? Each invocation of java creates a new JVM in
    >> a completely independent process.
    >>

    >
    > Not entirely true. JVMs share memory space, so the same class versions
    > and static variables stay constant throughout the computer.


    Only since Sun Java 1.5, and only for system classes
    [<http://java.sun.com/j2se/1.5.0/docs/guide/vm/class-data-sharing.html>]
    unless Sun changed this for Java 1.6
     
    Thomas Schodt, Mar 8, 2007
    #4
  5. ck Guest

    On Mar 9, 4:59 am, Thomas Schodt <>
    wrote:
    > Joshua Cranmer wrote:
    > > Nigel Wade wrote:
    > >> wrote:

    >
    > >>> hi can there be two JVM in a single machine

    >
    > >> Yes.

    >
    > And, in case OP means two JRE or SDK installations,
    > also yes.
    >
    > >>> if yes please provide me the details

    >
    > >> What details do you want? Each invocation of java creates a new JVM in
    > >> a completely independent process.

    >
    > > Not entirely true. JVMs share memory space, so the same class versions
    > > and static variables stay constant throughout the computer.

    >
    > Only since Sun Java 1.5, and only for system classes
    > [<http://java.sun.com/j2se/1.5.0/docs/guide/vm/class-data-sharing.html>]
    > unless Sun changed this for Java 1.6


    set a system variable called JAVA_HOME to point to your jdk folder
    (which contains the bin folder)
    add %JAVA_HOME%\bin to PATH

    If you have JDK 1.4 in (lets presume) c:\java\jdk1.4
    and JDK 1.5 in d:\java\jdk1.5
    To test JDK 1.4 set JAVA_HOME= c:\java\jdk1.4
    and to test JDK 1.5 set JAVA_HOME=c:\java\jdk1.5
    It is not necessary to install either of JDK (1.4 or 1.5)
    You can copy the jdk folder from any other place where these jdk are
    installed
    If you are going to test it in command prompt, make sure that you open
    a new command prompt after each change
    Or you can set it using set command in the command prompt.

    --
    Ck
    http://www.gfour.net
     
    ck, Mar 9, 2007
    #5
  6. Chris Uppal Guest

    Joshua Cranmer wrote:

    > > Each invocation of java creates a new JVM in a completely independent
    > > process.

    >
    > Not entirely true. JVMs share memory space, so the same class versions
    > and static variables stay constant throughout the computer.


    The way you phrase it makes it sound as if there's some sort of overlap, where
    operations in one JVM could affect code running in another one (e.g. changing a
    static variable). /Nothing/ which could possibly be detectable to even the
    lowest level Java code (or even JNI) is, or can be, shared between JVMs. In
    particular, JVMs do not share their address spaces (though that may not have
    been what you meant by "JVMs share memory space").

    There /are/ options for a certain amount of sharing of code (not Java code, and
    the JVM implementation itself), and data (but not data accessible to Java
    programs) between JVMs, but that's a matter which is entirely private to the
    JVM and OS between them. Its just a special case of the fact that most OSs can
    arrange to have a certain amount of code/data shared (invisibly) between
    separate invocations of the same code (same .exe or same .dll); and that with a
    bit of care from the programmers can arrange to share a certain amount of
    dynamically loaded, read-only (or copy-on-write), data too.

    So, the original advice (quoted above) is essentially correct, and is entirely
    correct for anything relating to the semantics of Java programs.

    -- chris
     
    Chris Uppal, Mar 9, 2007
    #6
  7. Lew Guest

    ck wrote:
    > set a system variable called JAVA_HOME to point to your jdk folder
    > (which contains the bin folder)
    > add %JAVA_HOME%\bin to PATH
    >
    > If you have JDK 1.4 in (lets presume) c:\java\jdk1.4
    > and JDK 1.5 in d:\java\jdk1.5
    > To test JDK 1.4 set JAVA_HOME= c:\java\jdk1.4
    > and to test JDK 1.5 set JAVA_HOME=c:\java\jdk1.5
    > It is not necessary to install either of JDK (1.4 or 1.5)
    > You can copy the jdk folder from any other place where these jdk are
    > installed
    > If you are going to test it in command prompt, make sure that you open
    > a new command prompt after each change
    > Or you can set it using set command in the command prompt.


    A less Windows-centric approach is to use symlinks (or the alternatives
    mechanism available in Linux) to make a canonical path reference that is flexible.

    -- Lew
     
    Lew, Mar 9, 2007
    #7
  8. Nigel Wade Guest

    Joshua Cranmer wrote:

    > Nigel Wade wrote:
    >> wrote:
    >>
    >>> hi can there be two JVM in a single machine

    >>
    >> Yes.
    >>
    >>> if yes please provide me
    >>> the details

    >>
    >> What details do you want?
    >> Each invocation of java creates a new JVM in a completely independent

    process.
    >>

    >
    > Not entirely true. JVMs share memory space, so the same class versions
    > and static variables stay constant throughout the computer.


    JVMs don't share memory space. Each JVM is an entirely separate process with its
    own virtual memory address space, and has its own classloader and heap. The JVM
    will almost certainly contain native code comprising shared libraries which
    will share native code. These shared libraries may have static data within them
    which can be shared, but this is not Java class static data.

    The classes, and any class static data within them, are loaded separately by
    each JVM into memory which is not shared between processes.

    --
    Nigel Wade, System Administrator, Space Plasma Physics Group,
    University of Leicester, Leicester, LE1 7RH, UK
    E-mail :
    Phone : +44 (0)116 2523548, Fax : +44 (0)116 2523555
     
    Nigel Wade, Mar 9, 2007
    #8
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Kevin Hooke

    Re: Handling both MS JVM and Sun JVM

    Kevin Hooke, Aug 26, 2003, in forum: Java
    Replies:
    2
    Views:
    877
  2. Lasse
    Replies:
    1
    Views:
    700
    Jon A. Cruz
    Jan 5, 2004
  3. astrorail
    Replies:
    4
    Views:
    584
    Tony Morris
    Oct 1, 2004
  4. Robert Wallace

    substitute two ore more with two or more

    Robert Wallace, Dec 31, 2003, in forum: Perl Misc
    Replies:
    1
    Views:
    106
    Big and Blue
    Dec 31, 2003
  5. Water Cooler v2
    Replies:
    2
    Views:
    471
    Water Cooler v2
    Apr 18, 2006
Loading...

Share This Page