If I start a Java application on a physical machine and then I start a second Java application, a third application ... etc.
Is every time a new Java Virtual machine started. So that every app has it's own JVM?
Or is the memory allocated for the first JVM enlarged by the operating system of the physical machine and all apps run in one JVM? So that there will be always only one JVM.
Actually when you "start an application", what you're doing is starting a new JVM and telling it to execute a class through the command line arguments.
However, in web applications executed inside a servlet container, each app will have it's own classloader, therefore they won't share the content of static variables. That could give you the impression that each runs on a different JVM.
JVM — instance of JRE. When you run application - new JVM is initialized. After application finished - the instance is removed by garbage collector.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With