Home » Java programming language

How to get the name of running Java VM in Java?

Java java.vm.name property example: Here, we are going to learn how to get and print the name of running Java VM in Java?
Submitted by IncludeHelp, on September 18, 2019

To get the name of running VM (Virtual Machine) in Java, we use the getProperties() method, which is defined in System class, while calling the method, we need to pass the property name to get the name of running Java VM.

The property to get the name of running Java VM is: "java.vm.name"

The method call is: System.getProperties("java.vm.name");

Java code to get and print the name of running Java VM

// 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_name = null;
        vm_name = System.getProperty("java.vm.name");
        System.out.println("Running Java vm is: " + vm_name);
    }
}

Output

Running Java vm is: Java HotSpot(TM) 64-Bit Server VM


Comments and Discussions!

Load comments ↻





Copyright © 2024 www.includehelp.com. All rights reserved.