Is there a way to get the parameters of a running JVM? Is there a command line tool like jstat which takes as input the pid of the JVM and returns its starting parameters? I
If you are interested in getting the JVM parameters of a running java process, then just do kill -3 java-pid. You will get a core dump file in which you can find the jvm parameters used while launching the java application.
You can use the JConsole command (or any other JMX client) to access that information.
If you can do this in java, try:
RuntimeMXBean
ManagementFactory
Example:
RuntimeMXBean runtimeMXBean = ManagementFactory.getRuntimeMXBean();
List<String> jvmArgs = runtimeMXBean.getInputArguments();
for (String arg : jvmArgs) {
System.out.println(arg);
}
This technique applies for any java application running local or remote.
jvisualvm can be found in any JDK since JDK 6 Update 7. Video tutorial on jvisualvm is here.
JConsole can do it. Also you can use a powerful jvisualVM tool, which also is included in JDK since 1.6.0.8.
On Linux:
java -XX:+PrintFlagsFinal -version | grep -iE 'HeapSize|PermSize|ThreadStackSize'
On Mac OSX:
java -XX:+PrintFlagsFinal -version | grep -iE 'heapsize|permsize|threadstacksize'
On Windows:
C:\>java -XX:+PrintFlagsFinal -version | findstr /i "HeapSize PermSize ThreadStackSize"
Source: https://www.mkyong.com/java/find-out-your-java-heap-memory-size/