Get arguments used to start a java process
There are times that we want to figure out what command line options where used to start a java process. There are a few ways we can do this. The examples below assume PID
is set to the process id we want to inspect:
ps
1
2
3
4
ps -f $PID
UID PID PPID C STIME TTY STAT TIME CMD
adrian 316721 313854 0 16:15 pts/6 Sl+ 0:00 /home/adrian/.cache/bazel/_bazel_adrian/28381a26654a75034a8803698f5ef496/execroot/__main__/bazel-out/k8-fastbuild/bin/main.runfiles/local_jdk/bin/java -classpath main.jar -Xdebug example.Main
Using jps
jps
doesn’t allow us to list a single process id, but we can see the command line arguments for all java processes: