detect server VM in reg test?

David Holmes david.holmes at
Tue Oct 11 21:51:13 UTC 2011

Hi Max,

On 12/10/2011 5:15 AM, Weijun Wang wrote:
> I have a test consuming quite a lot of memory and seems to be only
> working on server vms. I've added
> String vm = System.getProperty("");
> if (!vm.equals("Java HotSpot(TM) Server VM")) {
>   System.out.println("The test only runs on server VMs");
>   return;
> }
> Is there a better way to detect it?

Searching for contains("Server") would be less error-prone as the above 
will not work on 64-bit. But there is a better property to use:

which will report eg "Hotspot Client Compiler". However, these days both 
properties might report Tiered rather than Server. Also for -Xint doesn't exist.

That all said this seems like the wrong solution to the problem. Amount 
of memory used shouldn't be that dependent on client vs. server VM


More information about the core-libs-dev mailing list