Is there any way to detect if the host PC a java app is running on is a Virtual Computer or not? Just want to warn the user that they may ( rarely ) experience issues if using a VM and that we reccomend they use a physical machine if at all possible.
Asked
Active
Viewed 1,157 times
1
-
1A *Java* application that has problems on a VM? Honestly, I find that difficult to believe, unless you are using native code for hardware access e.g. a 3D engine. Would you mind providing some information on your host and guest OS, the VM software and what kind of issues you are seeing? – thkala Mar 12 '12 at 11:29
1 Answers
2
As the linked question explains, yes there are ways.
However, doing this from within a Java app is going to be more tricky. You'll either need to use System.exec(...)
to run a native application, or use JNI to call a native library to do the job.
But frankly:
Why would a pure Java app experience problems on a VM? Can't you just find the problem and fix it or provide a workaround?
If you can't, why don't you just describe the issue in the release notes?

Stephen C
- 698,415
- 94
- 811
- 1,216
-
To answer the why question in my experience. Our customer don't tell us they are running our product in a VM, until they start having performance issues. Customers won't mention it for weeks that they are running in VM. If we could detect it earlier, offer configuration suggestion or move them to dedicated harware, it would save us a lot of pain. – KaizenSoze Sep 25 '13 at 12:58