2525public class JvmRuntimeInfo {
2626
2727 private static final JvmRuntimeInfo CURRENT_VM = new JvmRuntimeInfo (System .getProperty ("java.version" ),
28- System .getProperty ("java.vm.name" ), System .getProperty ("java.vendor" ), System .getProperty ("java.vm.version" ));
28+ System .getProperty ("java.vm.name" ), System .getProperty ("java.vendor" ), System .getProperty ("java.vm.version" ),
29+ System .getProperty ("os.name" ));
2930
3031 private final String javaVersion ;
3132 private final String javaVmName ;
@@ -37,6 +38,7 @@ public class JvmRuntimeInfo {
3738 private final boolean isJ9 ;
3839 private final boolean isHpUx ;
3940 private final boolean isCoretto ;
41+ private final boolean isZos ;
4042
4143 public static JvmRuntimeInfo ofCurrentVM () {
4244 return CURRENT_VM ;
@@ -52,6 +54,10 @@ public static JvmRuntimeInfo ofCurrentVM() {
5254 * @param vmVersion jvm version, from {@code System.getProperty("java.vm.version")}
5355 */
5456 public JvmRuntimeInfo (String version , String vmName , String vendorName , @ Nullable String vmVersion ) {
57+ this (version , vmName , vendorName , vmVersion , null );
58+ }
59+
60+ private JvmRuntimeInfo (String version , String vmName , String vendorName , @ Nullable String vmVersion , @ Nullable String osName ) {
5561 javaVersion = version ;
5662 javaVmName = vmName ;
5763 javaVmVersion = vmVersion ;
@@ -61,6 +67,7 @@ public JvmRuntimeInfo(String version, String vmName, String vendorName, @Nullabl
6167 isJ9 = vmName .contains ("J9" );
6268 isHpUx = version .endsWith ("-hp-ux" );
6369 isCoretto = vendorName != null && vendorName .contains ("Amazon" );
70+ isZos = (osName != null ) && osName .toLowerCase ().contains ("z/os" );
6471
6572 if (isHpUx ) {
6673 // remove extra hp-ux suffix for parsing
@@ -162,6 +169,10 @@ public boolean isCoretto() {
162169 return isCoretto ;
163170 }
164171
172+ public boolean isZos () {
173+ return isZos ;
174+ }
175+
165176 @ Override
166177 public String toString () {
167178 return String .format ("%s %s %s" , javaVersion , javaVmName , javaVmVersion );
0 commit comments