I have tried jstack -l <PID> >> dump.log
and the dump.log file created with no content. Although I could see the thread dump in the terminal where the Java application was running but I need the thread dump in a file.
Moreover there is a message at the jstack output: Unable to open socket file: target process not responding or HotSpot VM not loaded.
I tried running java and jstack both by the system user but still no luck getting the pitut redirected to a file. I have used both java 8 and 9.
PS: I have googled about this issue and found people experiencing inconsistencies with having an outut file of jstack or jmap. Kindly let me know if you have any working solution to the problem.