Common Java Tools--jps

Source: Internet
Author: User

Brief introduction

The longest one to use.

The same functionality as the View Java Process command in Linux:

PS grep Java

The difference between JPS and this command is that JPS simply filters out the process of Java itself and the running boot class, which is the class that guides the main method.

Use

    • -Q outputs only VM identifiers, excluding class Name,jar name,arguments in Main method
    • -M output Main method parameters
    • -L outputs the full package name, applies the main class name, and the full path name of the jar
    • -V Output JVM parameters
    • -V outputs the parameters that are passed to the JVM by the flag file (the. hotspotrc file or the file specified by-xx:flags=
    • -joption Pass parameters to the VM, for example:-j-xms48m
Give me a chestnut??

Write a Java class to emulate the implementation of JPS:

1 Package service.test;2 3 import Com.sun.tools.attach.VirtualMachine;4 import Com.sun.tools.attach.VirtualMachineDescriptor;5 6 import java.util.List;7 8 /**9 * Created by Zhengbin on 16/8/30.Ten  */ One Public class Jpstest { A Public static void Main (string[] args) throws Interruptedexception { -List<virtualmachinedescriptor> machinedescriptors =virtualmachine.list (); -          for(Virtualmachinedescriptor machinedescriptor:machinedescriptors) { theSystem.out.println (Machinedescriptor.ID() +"\ t"+machinedescriptor.displayname ()); -         } -Thread.Sleep(Ten* +); -     } +}

Operation Result:

Execute the JPS command at the same time:

The execution result is the same as the jps-m command execution result.

Common Java Tools--jps

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.