Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / March 2007

Tip: Looking for answers? Try searching our database.

two or more jvm in a single machine

Thread view: 
santoshjoshi2003@yahoo.co.in - 08 Mar 2007 15:27 GMT
hi can there be two JVM in a single machine if yes please provide me
the details
Nigel Wade - 08 Mar 2007 16:38 GMT
> 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.

Signature

Nigel Wade, System Administrator, Space Plasma Physics Group,
           University of Leicester, Leicester, LE1 7RH, UK
E-mail :    nmw@ion.le.ac.uk
Phone :     +44 (0)116 2523548, Fax : +44 (0)116 2523555

Joshua Cranmer - 08 Mar 2007 23:30 GMT
>> hi can there be two JVM in a single machine
>
[quoted text clipped - 5 lines]
> 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.
Thomas Schodt - 08 Mar 2007 23:59 GMT
>>> 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
>>
[quoted text clipped - 3 lines]
> 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
ck - 09 Mar 2007 00:13 GMT
On Mar 9, 4:59 am, Thomas Schodt <spamtrap0...@xenoc.demon.co.uk>
wrote:
> >> santoshjoshi2...@yahoo.co.in wrote:
>
[quoted text clipped - 16 lines]
> [<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
Lew - 09 Mar 2007 04:57 GMT
> set a system variable called JAVA_HOME to point to your jdk folder
> (which contains the bin folder)
[quoted text clipped - 10 lines]
> 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
Chris Uppal - 09 Mar 2007 01:26 GMT
> > 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
Nigel Wade - 09 Mar 2007 15:29 GMT
>>> hi can there be two JVM in a single machine
>>
[quoted text clipped - 8 lines]
> 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.

Signature

Nigel Wade, System Administrator, Space Plasma Physics Group,
           University of Leicester, Leicester, LE1 7RH, UK
E-mail :    nmw@ion.le.ac.uk
Phone :     +44 (0)116 2523548, Fax : +44 (0)116 2523555



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.