How can I find the name of currently running java virtual machine name? I want to get it from java API.
Thanks
How can I find the name of currently running java virtual machine name? I want to get it from java API.
Thanks
Since you didn't really specify what you are looking for, take a look at these System Properties:
"java.vm.name"
"java.home"
"java.version"
"java.vendor"
"java.specification.vendor"
Like this:
System.out.println(System.getProperty("java.vm.name"));
System.out.println(System.getProperty("java.home"));
System.out.println(System.getProperty("java.vendor"));
System.out.println(System.getProperty("java.version"));
System.out.println(System.getProperty("java.specification.vendor"));
There are two kind of JVM names namely:
Type code in java program and see output:-
System.out.println("Java Virtual Machine specification version : "+System.getProperty("java.vm.specification.version"));
System.out.println("Java Virtual Machine specification vendor : "+System.getProperty("java.vm.specification.vendor"));
System.out.println("Java Virtual Machine specification name : "+System.getProperty("java.vm.specification.name"));
System.out.println("Java Virtual Machine implementation version : "+System.getProperty("java.vm.version"));
System.out.println("Java Virtual Machine implementation vendor : "+System.getProperty("java.vm.vendor"));
System.out.println("Java Virtual Machine implementation name : "+System.getProperty("java.vm.name"));
refer https://docs.oracle.com/cd/E15289_01/doc.40/e15062/sysprop.htm
To know ur JVM vendor:
type java -version
in cmd and see third line of it.
eg:
C:\Users\jack>java -version
java version "1.8.0_74"
Java(TM) SE Runtime Environment (build 1.8.0_74-b02)
Java HotSpot(TM) Client VM (build 25.74-b02, mixed mode)
If you are trying to get the process id of the current process you can do this.
There is a variety of properties you can get with System.getProperty()
, java.vm.name
seems like what you need.