Home » Java programming language

How to get the Java VM specifications in Java?

Java VM specifications example: Here, we are going to learn how to get and print the Java VM specifications in Java?
Submitted by IncludeHelp, on September 18, 2019

To get the details of the Java VM specifications, we use the getProperties() method, which is defined in System class, while calling the method, we need to pass the property names to get the Java VM specifications.

There are following Java VM specifications that we can get using the following properties,

  • java.vm.specification.version – it is used to get the Java VM specification version.
  • java.vm.specification.vendor – it is used to get the Java VM specification vendor name.
  • java.vm.specification.name – it is used to get the Java VM specification name.

Java code to get and print the Java VM specifications

// Java program to demonstrate the example of 
// getProperties() method of System Class

import java.lang.*;
import java.util.Properties;

public class Main {
    public static void main(String[] args) {
        String vm_spec_ver = null;
        String vm_spec_ven = null;
        String vm_spec_nam = null;
        
        vm_spec_ver = System.getProperty("java.vm.specification.version");
        vm_spec_ven = System.getProperty("java.vm.specification.vendor");
        vm_spec_nam = System.getProperty("java.vm.specification.name");
        
        System.out.println("Java Virtual Machine Specification Version: " + vm_spec_ver);
        System.out.println("Java Virtual Machine Specification Vendor : " + vm_spec_ven);
        System.out.println("Java Virtual Machine Specification Name   : " + vm_spec_nam);
    }
}

Output

Java Virtual Machine Specification Version: 10
Java Virtual Machine Specification Vendor : Oracle Corporation
Java Virtual Machine Specification Name   : Java Virtual Machine Specification





Comments and Discussions

Ad: Are you a blogger? Join our Blogging forum.




Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates


© https://www.includehelp.com some rights reserved.