`
niwtsew
  • 浏览: 72439 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

use jps instead of ps to find jvm process

阅读更多

copied from http://java.sun.com/j2se/1.5.0/docs/tooldocs/share/jps.html

 

 

jps - Java Virtual Machine Process Status Tool

SYNOPSIS

jps

 [ options

 ] [ hostid

 ]
options
Command-line options.
hostid
The host identifier of the host for which the process report should be generated. The hostid may include optional components that indicate the communications protocol, port number, and other implementation specific data.

DESCRIPTION

The jps tool lists the instrumented HotSpot Java Virtual Machines (JVMs) on the target system. The tool is limited to reporting information on JVMs for which it has the access permissions.

If jps is run without specifying a hostid , it will look for instrumented JVMs on the local host. If started with a hostid , it will look for JVMs on the indicated host, using the specified protocol and port. A jstatd process is assumed to be running on the target host.

The jps command will report the local VM identifier, or lvmid , for each instrumented JVM found on the target system. The lvmid is typically, but not necessarily, the operating system's process identifier for the JVM process. With no options, jps will list each Java application's lvmid followed by the short form of the application's class name or jar file name. The short form of the class name or JAR file name omits the class's package information or the JAR files path information.

The jps command uses the java launcher to find the class name and arguments passed to the main method. If the target JVM is started with a custom launcher, the class name (or JAR file name) and the arguments to the main method will not be available. In this case, the jps command will output the string Unknown for the class name or JAR file name and for the arguments to the main method.

The list of JVMs produced by the jps command may be limited by the permissions granted to the principal running the command. The command will only list the JVMs for which the principle has access rights as determined by operating system specific access control mechanisms.

NOTE: This utility is unsupported and may not be available in future versions of the JDK. It is not currently available on Windows 98 and Windows ME platforms.

OPTIONS

The jps command supports a number of options that modify the output of the command. These options are subject to change or removal in the future.

-q
Suppress the output of the class name, JAR file name, and arguments passed to the main method, producing only a list of local VM identifiers.
-m
Output the arguments passed to the main method. The output may be null for embedded JVMs.
<!-- <dt><b>-a</b> <dd>FUTURE: Search for all available Java Virtual Machines, not just those owned by the same user as the user running the <b>jps</b> command. <p> <dt><b>-u</b> <i>username</i> <dd>FUTURE: Search only for available Java Virtual Machines owned by the user <i>username</i>. <p> -->
-l
Output the full package name for the application's main class or the full path name to the application's JAR file.
-v
Output the arguments passed to the JVM.
-V
Output the arguments passed to the JVM through the flags file (the .hotspotrc file or the file specified by the -XX:Flags=<filename > argument).
-J option
Pass option to the java launcher called by javac . For example, -J-Xms48m sets the startup memory to 48 megabytes. It is a common convention for -J to pass options to the underlying VM executing applications written in Java.

HOST IDENTIFIER

The host identifier, or hostid is a string that indicates the target system. The syntax of the hostid string largely corresponds to the syntax of a URI:

[protocol

:][[//]hostname

][:port

][/servername

]
protocol
The communications protocol. If the protocol is omitted and a hostname is not specified, the default protocol is a platform specific, optimized, local protocol. If the protocol is omitted and a hostname is specified, then the default protocol is rmi .
hostname
A hostname or IP address indicating the target host. If hostname is omitted, then the target host is the local host.
port
The default port for communicating with the remote server. If the hostname is omitted or the protocol specifies an optimized, local protocol, then port is ignored. Otherwise, treatment of the port parameter is implementation specific. For the default rmi protocol the port indicates the port number for the rmiregistry on the remote host. If port is omitted, and protocol indicates rmi , then the default rmiregistry port (1099) is used.
servername
The treatment of this parameter depends on the implementation. For the optimized, local protocol, this field is ignored. For the rmi protocol, this parameter is a string representing the name of the RMI remote object on the remote host. See the -n option for the jstatd command.

OUTPUT FORMAT

The output of the jps command follows the following pattern:

lvmid

 [ [ classname

 | JARfilename

 | "Unknown"] [ arg

* ] [ jvmarg

* ] ]

Where all output tokens are separated by white space. An arg that includes embedded white space will introduce ambiguity when attempting to map arguments to their actual positional parameters.

NOTE : You are advised not to write scripts to parse jps output since the format may change in future releases. If you choose to write scripts that parse jps output, expect to modify them for future releases of this tool.

EXAMPLES

This section provides examples of the jps command.

Listing the instrumented JVMs on the local host:

jps


18027 Java2Demo.JAR
18032 jps
18005 jstat

Listing the instrumented JVMs on a remote host:

This example assumes that the jstat server and either the its internal RMI registry or a separate external rmiregistry process are running on the remote host on the default port (port 1099). It also assumes that the local host has appropriate permissions to access the remote host. This example also includes the -l option to output the long form of the class names or JAR file names.

jps -l remote.domain


3002 /opt/j2sdk1.5.0/demo/jfc/Java2D/Java2Demo.JAR
2857 sun.tools.jstatd.jstatd

Listing the instrumented JVMs on a remote host with a non-default port for the RMI registry

This example assumes that the jstatd server, with an internal RMI registry bound to port 2002, is running on the remote host. This example also uses the -m option to include the arguments passed to the main method of each of the listed Java applications.

jps -m remote.domain:2002


3002 /opt/j2sdk1.5.0/demo/jfc/Java2D/Java2Demo.JAR
3102 sun.tools.jstatd.jstatd -p 2002

SEE ALSO


Copyright © 2003 Sun Microsystems, Inc. All Rights Reserved.

Sun
Java Software

<script src="http://java.sun.com/js/omi/jsc/s_code_remote.js"></script><script src="http://www-cdn.sun.com/share/metrics/metrics_group1.js"></script>

分享到:
评论

相关推荐

    Java长期运行后, jps等工具无法连接jvm

    Java长期运行后,jps等工具无法连接jvm的原因和解决方法 Java长期运行后,jps等工具无法连接jvm是一个常见的问题,很多开发者都曾经遇到过这种情况。这种情况的出现使得故障诊断变得非常困难。那么,究竟是什么原因...

    JVM性能调优监控工具jps、jstack、jmap、jhat、jstat使用详解.docx

    JVM性能调优监控工具jps、jstack、jmap、jhat、jstat使用详解 本文将对一些常用的 JVM 性能调优监控工具进行介绍,包括 jps、jstack、jmap、jhat、jstat 等工具的使用详解。这些工具对于 Java 程序员来说是必备的,...

    tomcat解决JPS不可用的问题

    JPS(Java Process Status Tool)是 Java 虚拟机的进程状态工具,用于显示当前 Java 进程的信息。然而,在某些情况下,JPS 命令可能不可用,导致无法查看 Java 进程的信息。 导致 JPS 不可用的原因可能是因为环境...

    Bug:Address already in use: JVM_Bind问题之总结

    在编程和系统开发过程中,我们可能会遇到一个常见的错误——"Address already in use: JVM_Bind"。这个错误通常发生在尝试绑定一个已经被占用的网络端口时。本文将深入探讨这个问题,提供解决方案,并从源码角度解析...

    jvm内存监控工具使用

    jps 工具类似于 Unix/Linux 系统中的 ps 命令,用于列出本地或远程主机上正在运行的所有 Java 进程的 ID 和主类名或 JAR 文件名。这对于识别正在运行的 Java 应用程序非常有用,尤其是当系统中有多个 Java 进程时,...

    JVM监控实例数 windows监控 线程测试 单例模式下测试JVM实例是否一个

    在Windows操作系统中,我们可以使用`jps`命令,这是Java Virtual Machine Process Status Tool的一部分,用于显示正在运行的Java进程。打开命令行终端,输入以下命令: ``` jps -l ``` 这将列出所有JVM进程及其...

    jvm常用命令工具

    jps - JVM Process Status Tool **用途**:列出当前系统中正在运行的所有HotSpot虚拟机进程,并显示每个进程的PID及主类名。 **命令格式**: ``` jps [options] [hostid] ``` **执行示例**: ``` jps -l ``` **...

    jvm监控工具介绍

    jps(Java Process Status)简单易用,用于列出系统中所有运行的JVM进程及其ID、启动路径等信息,是检查Java应用程序是否正常运行的快速方法。 8. **jstatd**: jstatd是JVM监控服务,它基于RMI(Remote Method ...

    JPS算法的python实现及其可视化

    **JPS算法详解** JPS,全称Jump Point Search(跳跃点搜索),是一种优化的A*寻路算法,尤其适用于网格环境中的路径寻找。在游戏开发、机器人路径规划等领域,JPS能显著提高效率,降低计算量,同时保持路径质量。 ...

    JAVA JVM性能调优监控工具详解

    #### 一、jps (Java Virtual Machine Process Status Tool) `jps`是JDK自带的一个简单实用的工具,用于列出当前正在运行的所有Java应用程序的进程ID以及基本状态信息。其语法格式如下: ```shell jps [options] ...

    JPS(Jump Point Search)A*跳点搜索

    **JPS(Jump Point Search)A*跳点搜索** JPS(Jump Point Search)是一种优化的路径搜索算法,它是A*算法的一种变体,专为网格环境中的路径规划设计。A*算法是广泛应用的最短路径查找算法,以其效率和准确性而闻名...

    网站地图查询同于jps

    而JPS,全称Java Process Status,是Java应用程序的一种监控工具,主要用来查看运行在Java虚拟机(JVM)上的所有进程的状态。在电子地图服务中,JPS可能用于监控后台服务的运行状况,确保地图数据的实时更新、定位...

    深入JVM内核—原理、诊断与优化视频教程-2.JVM运行机制

    10. **JVM诊断工具**:JDK提供了丰富的命令行工具,如jps(Java进程查看)、jstat(统计JVM各种数据)、jmap(内存映射工具)、jhat(堆转储分析)、jconsole(GUI监控工具)等,用于监控和诊断JVM的运行状态。...

    kotlin-jps-plugin.jar

    kotlin-jps-plugin.jar

    jvm课程ppt

    JDK提供了一系列的工具,如jps(Java进程查看)、jstat(统计信息)、jmap(内存映射)、jhat(堆分析)、jstack(线程堆栈快照)等,用于监控JVM的状态、分析性能问题和排查错误。 七、JVM内存模型 Java内存模型...

    JVM学习笔记(一)

    ### JVM学习笔记(一) #### 一、JVM概述与工具使用 JVM(Java Virtual Machine)是Java语言的核心组成部分之一,它为Java程序提供了一个跨平台的运行环境。本篇学习笔记主要介绍如何利用一系列工具来查看和监控JVM...

    jvm参数设置

    2. **jps**: 显示当前Java进程中JVM的PID。 3. **jmap -heap PID**: 查看指定PID的JVM堆内存详细信息。 4. **jstat -gcutil PID**: 每隔500毫秒打印一次指定PID的JVM的GC利用率信息。 - **Eden**: 新生代中的...

    JVM调优工具命令详解.pdf

    在现代的软件开发与运行环境中,Java虚拟机(JVM)的性能调优是非常重要的一环,特别是在处理大型应用程序或者服务时,合适的JVM调优能够显著提升系统性能和稳定性。本篇文档详细介绍了JVM调优工具的命令使用及其...

    JVM与Hadoop介绍

    ### JVM与Hadoop介绍 #### 一、Java虚拟机(JVM)概述 Java虚拟机(JVM)是执行Java字节码的虚拟机环境。它提供了一个独立于硬件平台的运行时环境,使得Java应用程序能够在任何支持JVM的操作系统上运行。 #### 二、...

    java性能调优工具命令大全.zip

    jvm性能调优工具命令大全.zip jps jstat jmap jhat jstack jinfo jps JVM Process Status Tool GChisto jvisualvm ...

Global site tag (gtag.js) - Google Analytics