Close

VM arguments

Have you ever wondered where that value came from in a Java program? One place to look for is the VM arguments. They are set in the system and not when you are writing your code.

A code like this will give you some good understanding of VM arguments.

import java.lang.management.ManagementFactory;
import java.lang.management.RuntimeMXBean;

RuntimeMXBean RuntimemxBean = ManagementFactory.getRuntimeMXBean();
List arguments = RuntimemxBean.getInputArguments();
Iterator iterator = arguments.iterator();
System.out.println(“VM arguments”);
int i=0;
for(;iterator.hasNext();)
{
System.out.println(iterator.next().toString());
}
System.out.println(“Number of VM arguments :”+i);

Leave a Reply

Your email address will not be published. Required fields are marked *