I would like to know if my no VM argument invocation of HotSpot Java is running with -client, -server, or tiered compilation options. When I supply no VM arguments, which one is chosen by default? Is there a way to output diagnostics about which JIT compiler is running?
3 Answers
Assuming this is Hotspot:
-XshowSettings:vm
For example, on my Windows box I get output of:
VM settings:
Max. Heap Size (Estimated): 1.77G
Ergonomics Machine Class: client
Using VM: Java HotSpot(TM) 64-Bit Server VM

- 1,421,763
- 867
- 9,128
- 9,194
-
Thanks Jon. I am running Hotspot on OS X, but for Java 1.6 & 1.7 that option is unrecognized, alas. – Julien Chastang Feb 11 '13 at 19:34
-
@JulienChastang: That's odd - it's fine for me on both Windows and Linux. What does `java -X` show? – Jon Skeet Feb 11 '13 at 19:34
-
My bad. Actually on 1.6 it is unrecognized, but on 1.7 it gives me the sort of information you provide above. Curiously, when I supply the java -client -XshowSettings:vm it still claims to be Server. Charles Nutter (http://blog.headius.com/2009/01/my-favorite-hotspot-jvm-flags.html) seems to suggest that if you are on 64 bit, -server is the only option. It would be nice to get some clarity about this from Oracle. – Julien Chastang Feb 11 '13 at 19:58
From the program that is run, you could query the java.vm.name
property to differentiate between client and server mode. On hotspot it will contain "Server" if you have used that option (for example: Java HotSpot(TM) 64-Bit Server VM
).
According to this page:
Tiered compilation is now the default mode for the server VM.
Note: it works now but is probably not the most future-proof approach.

- 321,522
- 82
- 660
- 783
Slightly better method of determining which JIT compiler is in use.
On a Windows machine with 32-bit JDK8:
$ java -version java version "1.8.0" Java(TM) SE Runtime Environment (build 1.8.0-b132) Java HotSpot(TM) Client VM (build 25.0-b70, mixed mode) $ java -XshowSettings -version 2>&1 | grep sun.management.compiler sun.management.compiler = HotSpot Client Compiler $ java -server -XshowSettings -version 2>&1 | grep sun.management.compiler sun.management.compiler = HotSpot Tiered Compilers
So the Client Compiler is the default with the Windows 32-bit JDK8 and the '-server' option gets you the 32-bit Tiered Compiler.
On a Windows machine with 64-bit JDK8:
$ java -version java version "1.8.0" Java(TM) SE Runtime Environment (build 1.8.0-b132) Java HotSpot(TM) 64-Bit Server VM (build 25.0-b70, mixed mode) $ java -XshowSettings -version 2>&1 | grep sun.management.compiler sun.management.compiler = HotSpot 64-Bit Tiered Compilers
So the Tiered Compiler is the default with the Windows 64-bit JDK8. Oracle does not provide a 64-bit Client VM.

- 11
- 2