Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

can I run more than one JVM on my single PC?

Tags:

java

Can I run more than one JVM? If yes then how can I find a particular class is loaded on which JVM?

like image 200
giri Avatar asked Dec 31 '09 18:12

giri


2 Answers

You can run as many JVMs as you can fit on your disk and in memory :)

Whenever you start a Java application, you're first starting the JVM and then telling it which application to run. The answer to "which JVM" is simply: The JVM that you loaded the application with!

It's possible to do some esoteric fiddling with classloaders which would prove an exception to what I've just said. But it's true in the general case and the majority of all applications.

like image 105
Carl Smotricz Avatar answered Oct 25 '22 12:10

Carl Smotricz


It's not entirely clear what you mean, but:

  • You can have more than one VM (version / brand etc) installed on the same machine
  • You can run more than one java process, whether of the same JVM version or different ones

Unless you're running a debugging agent or something similar, I don't know of any way to ask a JVM process whether it's loaded a particular class. It seems a bit of an odd requirement - why do you want to do this?

like image 21
Jon Skeet Avatar answered Oct 25 '22 12:10

Jon Skeet