Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there one JVM per Java application?

Tags:

java

process

jvm

Is the same JVM used by all Java applications running or, does 'one JVM per Java application' apply? (say the applications are IntelliJ IDEA, a server and NetBeans for example)

Further, is there any connection between JVMs assigned and processes used by each Java application?

like image 550
nadh Avatar asked May 10 '11 08:05

nadh


People also ask

Can we have more than one JVM?

Yes,you can install more than one jvm in your PC, because OS loads an instance of jvm (not whole jvm) in RAM. We can call different jvm like JDK 1.4 or JDK 1.6 by setting its path. Show activity on this post. Multiple JRE (Java Runtime Enviroment) is very possible.

Can you deploy more than one application in single JVM?

Can i deploy two applications having same context root on same or different jvm in WebSphere application server? Hello! if you use same console for both apps - you can deploy application on different servers (different ports) with same context root, but you must use different application name.

How many JVM instances can run on a machine?

Infinite! Multiple JVMs can run on a single machine, as for example, for execution of applets a separate JVM may exist and another JVM can be started by the User for execution of Java Byte Code, on a single machine.

Is JVM shared?

If you run the java command multiple times, you get multiple instances of the JVM. In theory these are entirely separate with nothing shared, but some implementations of the JVM (now or in the past) might attempt to share some portions of the data.


1 Answers

Generally speaking, each application will get its own JVM instance and its own OS-level process and each JVM instance is independent of each other.

There are some implementation details such as Class Data Sharing, where multiple JVM instances might share some data/memory but those have no user-visible effect to the applications (except for improved startup time, hopefully).

A common scenario however is a single application server (or "web server") such as Glassfish or Tomcat running multiple web applications. In this case, multiple web applications can share a JVM.

like image 82
Joachim Sauer Avatar answered Sep 29 '22 17:09

Joachim Sauer