Does invoking java via two different command line involves two different JVMs or two separate instances of same JVM.
Does invoking java via two different command line involves two different JVMs or two
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
JVM is Java Virtual Machine, a memory space where classes (code) are loaded and objects (data) are shared. JVM is equivalent to an Operating System process.
When you type
java...in you command line you are executing an independent process that loads Java classes in memory, the base classes from Java and yours (from the .class files or .jar you indicate).Another
java...command will load a different process with its own memory and will load classes by itself.Instance word confusion: when you say ‘two instances of the same JVM’. It’s usual to say instance of a JVM to a separate process, it is, to a loaded independent JVM. If you are saying: two process are running JVM 1.5, OK, it’s the same JVM in the sense it’s the same version but they are different processes, different ‘instances’, independent in all sense.
Webapp confusion: A webapp (by example) is simply a bunch of classes and objects instantiated, attending some URL in a web server. You can start Tomcat with 10 different apps -it is, 10 different bunches of classes and objects each of them attending different request, but in fact they share the same memory space (OS process). A webapp cannot touch other webapp’s objects because nobody gives it a reference to the other objects (and classes are in some way hidden but that’s another story called: class-loading).