KBEC-00052 - Installing JDK and taking a jstack threads dump or stack dump

Article ID:360033194731
2 minute readKnowledge base
On this page


The ElectricCommander server is a Java application. To examine the memory internals of the JVM (sometimes necessary for factory analysis), the JDK must be configured on the ElectricCommander server. This article provides a step-by-step process to download the JVM and use the jstack utility to take a capture of the JVM stack which includes all the threads in stack memory.


Retrieving and installing the JVM

The JVM is only available as part of the Java-1.7 JDK found at https://www.oracle.com/technetwork/java/javase/overview/index.html.

  1. Go to the "Downloads" tab, "Previous Releases" subtab, "Java SE 7" entry.

  2. Find the JRE version on the system. Use "java -version" to see which version is on your system. build 1.7.0_45-b18, also know as 6u21, was in use for many Commander versions.

  3. select for example the "Java SE Runtime Environment 7u5" selection.

  4. download your platform version, for example jre-7u55-windows-i586.exe

For pre 4.2 versions, use Java 1.6 (i.e. jdk1.6.0_04)

For 4.2 and beyond, please use Java 1.7 (i.e. the most recent at the time of writing: 1.7.0_45-b18)

Taking the thread dump (Windows)

Log in on the physical console or when using Remote Desktop specify the /admin option:

mstsc.exe /admin

Use the DOS command to find the PID of java.exe

tasklist /FI ``"IMAGENAME eq java.exe"

Using the JDK jstack utility, take a thread dump of the JVM:

"c:\program files\java\1.7.0_45-b18\bin\jstack.exe" `-l ` > threads.txt

where is the process ID of the JVM process, java.exe.

Taking the thread dump (Linux)

Use the shell command to find the PID of java.exe

ps -e | grep java

The process ID is the first number on the line returned by the command Using the JDK jstack utility, take a thread dump of the JVM:

`jstack -l ` > threads.txt

where is the process ID of the JVM process.

Taking a thread dump using ectool

To get just a JRE thread dump - new in Commander release 3.2 - use:

ectool getServerStatus --diagnostics ``1

The thread dump output includes a table of Commander performance metrics.

Don’t forget the Commander log files

To complete the diagnostic tools, include the Commander log files (commander.log and the previously zipped logs) covering the period up to the time of the thread dump.

When the Commander server is stopped, the output of getServerStatus --diagnostics 1 is placed in commander.log.