jcmd-hUsage:jcmd 또는 :jcmd-l &a"/> jcmd-hUsage:jcmd 또는 :jcmd-l &a">

 >  기사  >  Java  >  Java 9에서 jcmd 도구의 중요성은 무엇입니까?

Java 9에서 jcmd 도구의 중요성은 무엇입니까?

PHPz
PHPz앞으로
2023-09-15 18:21:031274검색

jcmd工具在Java 9中的重要性是什么?

"jcmd"은 JVM Diagnostic 도구로, 특정 JVM 시스템에 대해 로컬로 진단 명령을 실행하는 데 사용되는 명령줄 도구입니다. 이 도구는 Java 7 버전부터 JDK 설치에 포함되어 있으며 "%java_home%binjcmd.exe" 프로그램 파일로 나타낼 수 있습니다. 환경 변수 "path"에 "%java_home%bin" 디렉터리를 포함하면 "jcmd -h" 명령을 실행하여 모든 디렉터리의 전체 목록을 볼 수 있습니다. 옵션은 다음과 같습니다

<strong>C:\Users\User>jcmd -h
Usage: jcmd
   or: jcmd -l
   or: jcmd -h

   command must be a valid jcmd command for the selected jvm.
   Use the command "help" to see which commands are available.
   If the pid is 0, commands will be sent to all Java processes.
   The main class argument will be used to match (either partially
   or fully) the class used to start Java.
   If no options are given, lists Java processes (same as -l).

   PerfCounter.print display the counters exposed by this process
   -f read and execute commands from the file
   -l list JVM processes on the local machine
   -h this help</strong>

예제입니다.

public class JCmdToolTest {
   public static void main(String args[]) {
      <strong>Runtime </strong>runtime = Runtime.<strong>getRuntime()</strong>;
      System.out.println("Free memory: " + runtime.<strong>freeMemory()</strong>);
      System.out.println("Total memory: " + runtime.<strong>totalMemory()</strong>);
      try {
         Thread.sleep(5000);
      } catch(InterruptedException e) {
      }
   }
}

Output

<strong>Free memory: 65454560
Total memory: 67108864</strong>

"jcmd -l" 명령을 사용하여 로컬에서 실행 중인 모든 JVM 시스템을 나열한 다음 출력에서 ​​PID 또는 클래스 main을 사용하여 식별할 수 있습니다. JVM.

rreee

위 내용은 Java 9에서 jcmd 도구의 중요성은 무엇입니까?의 상세 내용입니다. 자세한 내용은 PHP 중국어 웹사이트의 기타 관련 기사를 참조하세요!

성명:
이 기사는 tutorialspoint.com에서 복제됩니다. 침해가 있는 경우 admin@php.cn으로 문의하시기 바랍니다. 삭제