List of Java processes

前端 未结 18 2228
长发绾君心
长发绾君心 2020-12-22 16:44

How can I list all Java processes in bash? I need an command line. I know there is command ps but I don\'t know what parameters I need to use.

18条回答
  •  太阳男子
    2020-12-22 17:17

    Starting from Java 7, the simplest way and less error prone is to simply use the command jcmd that is part of the JDK such that it will work the same way on all OS.

    Example:

    > jcmd
    5485 sun.tools.jcmd.JCmd
    2125 MyProgram
    

    jcmd allows to send diagnostic command requests to a running Java Virtual Machine (JVM).

    More details about how to use jcmd.

    See also the jcmd Utility

提交回复
热议问题