zoukankan      html  css  js  c++  java
  • jcmd命令实战

    继续来根据之前的那篇infoq的文章的介绍熟悉工具,上一次咱们学习使用了:

    接下来学习它里面提到的另一个工具:

    jcmd是一个非常之强大的命令行工具,能输出很多很多的信息,也是在处理JVM的一些问题经常要接触到的一个工具,这个命令也是需要一个进程ID的,而在之前咱们来查询pid时是使用了一个不是特别简明的一个方式,回忆一下:

    其实jdk提供了一个jps来获取JVM进程的所有pid信息,而且非常简洁,下面来瞅一下:

    可以查看一下它的使用帮助:

    加上不同的参数其输出也会不一样,简单的演练一下:

    其实最常用的是:

    还可以:

    总之,之后查看JVM可以用jps来代替之前的ps繁琐方式啦,接下来用一下jcmd命令,直接敲它:

    貌似跟jps命令没啥大的区别,都是获取当前JVM进程的一些信息,也就是简单的jcmd命令跟jps在打印JVM信息上是可以互换的,当然要是jcmd只有这个功能那也不会专门来学习它了,先来瞅一下它的帮助使用说明:

    jcmd pid VM.flags:查看JVM的启动参数

    接下来具体用jcmd来查询JVM的一些东东,先来查看一下JVM的启动参数,首先还是运行一下MyTest5这个程序:

    然后查看一下它进程:

    接下来用jcmd来查看一下此进程的JVM启动参数,可以:

    这就可以清晰的通过命令的方式来查看到启动参数啦,还是很方便。

    由于MyTest5这个程序木有手动配置自己的JVM启动参数:

    这里换成MyTest4,因为它配启动参数了:

    启动一下它,然后再查看一下:

    jcmd pid help:列出当前运行的Java进程可以执行的操作。

    在上面查看JVM的启动参数命令中,有个东东很奇怪:

    那这些操作来源于哪里呢?其实可以通过标题所示的这个命令来查看,咱们还是以MyTest5运行为例演示一下它的用法:

    也可以明显感受到jcmd的强大之处,上面这么多只挑重点来学习。

    jcmd pid help JFR.dump:查看具体命令的选项。

    我们已经知道了命令可以跟一些哪些执行操作,那具体操作的选项又有哪些呢,于是乎用它就可以了,以JFR.dump为例:

    jcmd pid PerfCounter.print:查看JVM性能相关的参数。

    直接试验一下:

    xiongweideMacBook-Pro:CoffeeMachineClient xiongwei$ jcmd 97595 help JFR.dump
    97595:
    JFR.dump
    Copies contents of a JFR recording to file. Either the name or the recording id must be specified.
    
    Impact: Low
    
    Permission: java.lang.management.ManagementPermission(monitor)
    
    Syntax : JFR.dump [options]
    
    Options: (options must be specified using the <key> or <key>=<value> syntax)
        name : [optional] Recording name, e.g. "My Recording" (STRING, no default value)
        recording : [optional] Recording number, use JFR.check to list available recordings (JLONG, -1)
        filename :  Copy recording data to file, i.e "/Users/user/My Recording.jfr" (STRING, no default value)
        compress : [optional] GZip-compress "filename" destination (BOOLEAN, false)
    xiongweideMacBook-Pro:CoffeeMachineClient xiongwei$ jcmd 97595 PerfCounter.print
    97595:
    java.ci.totalTime=94549036
    java.cls.loadedClasses=516
    java.cls.sharedLoadedClasses=0
    java.cls.sharedUnloadedClasses=0
    java.cls.unloadedClasses=0
    java.property.java.class.path="/Library/Java/JavaVirtualMachines/jdk1.8.0_92.jdk/Contents/Home/jre/lib/charsets.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_92.jdk/Contents/Home/jre/lib/deploy.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_92.jdk/Contents/Home/jre/lib/ext/cldrdata.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_92.jdk/Contents/Home/jre/lib/ext/dnsns.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_92.jdk/Contents/Home/jre/lib/ext/jaccess.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_92.jdk/Contents/Home/jre/lib/ext/jfxrt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_92.jdk/Contents/Home/jre/lib/ext/localedata.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_92.jdk/Contents/Home/jre/lib/ext/nashorn.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_92.jdk/Contents/Home/jre/lib/ext/sunec.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_92.jdk/Contents/Home/jre/lib/ext/sunjce_provider.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_92.jdk/Contents/Home/jre/lib/ext/sunpkcs11.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_92.jdk/Conten"
    java.property.java.endorsed.dirs="/Library/Java/JavaVirtualMachines/jdk1.8.0_92.jdk/Contents/Home/jre/lib/endorsed"
    java.property.java.ext.dirs="/Users/xiongwei/Library/Java/Extensions:/Library/Java/JavaVirtualMachines/jdk1.8.0_92.jdk/Contents/Home/jre/lib/ext:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java"
    java.property.java.home="/Library/Java/JavaVirtualMachines/jdk1.8.0_92.jdk/Contents/Home/jre"
    java.property.java.library.path="/Users/xiongwei/Library/Java/Extensions:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java:."
    java.property.java.version="1.8.0_92"
    java.property.java.vm.info="mixed mode"
    java.property.java.vm.name="Java HotSpot(TM) 64-Bit Server VM"
    java.property.java.vm.specification.name="Java Virtual Machine Specification"
    java.property.java.vm.specification.vendor="Oracle Corporation"
    java.property.java.vm.specification.version="1.8"
    java.property.java.vm.vendor="Oracle Corporation"
    java.property.java.vm.version="25.92-b14"
    java.rt.vmArgs="-Dfile.encoding=UTF-8"
    java.rt.vmFlags=""
    java.threads.daemon=4
    java.threads.live=5
    java.threads.livePeak=5
    java.threads.started=5
    sun.ci.compilerThread.0.compiles=3
    sun.ci.compilerThread.0.method=""
    sun.ci.compilerThread.0.time=2053
    sun.ci.compilerThread.0.type=1
    sun.ci.compilerThread.1.compiles=1
    sun.ci.compilerThread.1.method=""
    sun.ci.compilerThread.1.time=313
    sun.ci.compilerThread.1.type=1
    sun.ci.compilerThread.2.compiles=118
    sun.ci.compilerThread.2.method=""
    sun.ci.compilerThread.2.time=41561
    sun.ci.compilerThread.2.type=1
    sun.ci.lastFailedMethod=""
    sun.ci.lastFailedType=0
    sun.ci.lastInvalidatedMethod=""
    sun.ci.lastInvalidatedType=0
    sun.ci.lastMethod="java/lang/String indexOf"
    sun.ci.lastSize=70
    sun.ci.lastType=1
    sun.ci.nmethodCodeSize=124064
    sun.ci.nmethodSize=206088
    sun.ci.osrBytes=0
    sun.ci.osrCompiles=0
    sun.ci.osrTime=0
    sun.ci.standardBytes=8561
    sun.ci.standardCompiles=122
    sun.ci.standardTime=94549036
    sun.ci.threads=3
    sun.ci.totalBailouts=0
    sun.ci.totalCompiles=122
    sun.ci.totalInvalidates=0
    sun.classloader.findClassTime=75394974
    sun.classloader.findClasses=1
    sun.classloader.parentDelegationTime=75632149
    sun.cls.appClassBytes=795
    sun.cls.appClassLoadCount=7
    sun.cls.appClassLoadTime=1380939
    sun.cls.appClassLoadTime.self=1379136
    sun.cls.classInitTime=200207388
    sun.cls.classInitTime.self=83134592
    sun.cls.classLinkedTime=30790764
    sun.cls.classLinkedTime.self=27199048
    sun.cls.classVerifyTime=3495135
    sun.cls.classVerifyTime.self=2190525
    sun.cls.defineAppClassTime=185979
    sun.cls.defineAppClassTime.self=12729
    sun.cls.defineAppClasses=1
    sun.cls.initializedClasses=417
    sun.cls.isUnsyncloadClassSet=0
    sun.cls.jniDefineClassNoLockCalls=0
    sun.cls.jvmDefineClassNoLockCalls=1
    sun.cls.jvmFindLoadedClassNoLockCalls=20
    sun.cls.linkedClasses=459
    sun.cls.loadInstanceClassFailRate=0
    sun.cls.loadedBytes=1076800
    sun.cls.lookupSysClassTime=179168672
    sun.cls.methodBytes=685560
    sun.cls.nonSystemLoaderLockContentionRate=0
    sun.cls.parseClassTime=108368386
    sun.cls.parseClassTime.self=70142981
    sun.cls.sharedClassLoadTime=70544
    sun.cls.sharedLoadedBytes=0
    sun.cls.sharedUnloadedBytes=0
    sun.cls.sysClassBytes=1950237
    sun.cls.sysClassLoadTime=324675751
    sun.cls.systemLoaderLockContentionRate=0
    sun.cls.time=363112365
    sun.cls.unloadedBytes=0
    sun.cls.unsafeDefineClassCalls=0
    sun.cls.verifiedClasses=459
    sun.gc.cause="No GC"
    sun.gc.collector.0.invocations=0
    sun.gc.collector.0.lastEntryTime=0
    sun.gc.collector.0.lastExitTime=0
    sun.gc.collector.0.name="PSScavenge"
    sun.gc.collector.0.time=0
    sun.gc.collector.1.invocations=0
    sun.gc.collector.1.lastEntryTime=0
    sun.gc.collector.1.lastExitTime=0
    sun.gc.collector.1.name="PSParallelCompact"
    sun.gc.collector.1.time=0
    sun.gc.compressedclassspace.capacity=393216
    sun.gc.compressedclassspace.maxCapacity=1073741824
    sun.gc.compressedclassspace.minCapacity=0
    sun.gc.compressedclassspace.used=77664
    sun.gc.generation.0.capacity=44564480
    sun.gc.generation.0.maxCapacity=715653120
    sun.gc.generation.0.minCapacity=44564480
    sun.gc.generation.0.name="new"
    sun.gc.generation.0.space.0.capacity=34078720
    sun.gc.generation.0.space.0.initCapacity=0
    sun.gc.generation.0.space.0.maxCapacity=714604544
    sun.gc.generation.0.space.0.name="eden"
    sun.gc.generation.0.space.0.used=3408368
    sun.gc.generation.0.space.1.capacity=5242880
    sun.gc.generation.0.space.1.initCapacity=0
    sun.gc.generation.0.space.1.maxCapacity=238551040
    sun.gc.generation.0.space.1.name="s0"
    sun.gc.generation.0.space.1.used=0
    sun.gc.generation.0.space.2.capacity=5242880
    sun.gc.generation.0.space.2.initCapacity=0
    sun.gc.generation.0.space.2.maxCapacity=238551040
    sun.gc.generation.0.space.2.name="s1"
    sun.gc.generation.0.space.2.used=0
    sun.gc.generation.0.spaces=3
    sun.gc.generation.1.capacity=89653248
    sun.gc.generation.1.maxCapacity=1431830528
    sun.gc.generation.1.minCapacity=89653248
    sun.gc.generation.1.name="old"
    sun.gc.generation.1.space.0.capacity=89653248
    sun.gc.generation.1.space.0.initCapacity=89653248
    sun.gc.generation.1.space.0.maxCapacity=1431830528
    sun.gc.generation.1.space.0.name="old"
    sun.gc.generation.1.space.0.used=0
    sun.gc.generation.1.spaces=1
    sun.gc.lastCause="No GC"
    sun.gc.metaspace.capacity=4587520
    sun.gc.metaspace.maxCapacity=1082130432
    sun.gc.metaspace.minCapacity=0
    sun.gc.metaspace.used=792432
    sun.gc.policy.avgBaseFootprint=0
    sun.gc.policy.avgMajorIntervalTime=0
    sun.gc.policy.avgMajorPauseTime=0
    sun.gc.policy.avgMinorIntervalTime=0
    sun.gc.policy.avgMinorPauseTime=0
    sun.gc.policy.avgOldLive=0
    sun.gc.policy.avgPretenuredPaddedAvg=0
    sun.gc.policy.avgPromotedAvg=34078720
    sun.gc.policy.avgPromotedDev=0
    sun.gc.policy.avgPromotedPaddedAvg=34078720
    sun.gc.policy.avgSurvivedAvg=5242880
    sun.gc.policy.avgSurvivedDev=0
    sun.gc.policy.avgSurvivedPaddedAvg=5242880
    sun.gc.policy.avgYoungLive=0
    sun.gc.policy.boundaryMoved=0
    sun.gc.policy.changeOldGenForMajPauses=0
    sun.gc.policy.changeOldGenForMinPauses=0
    sun.gc.policy.changeYoungGenForMajPauses=0
    sun.gc.policy.changeYoungGenForMinPauses=0
    sun.gc.policy.collectors=2
    sun.gc.policy.decideAtFullGc=0
    sun.gc.policy.decreaseForFootprint=0
    sun.gc.policy.decrementTenuringThresholdForGcCost=0
    sun.gc.policy.decrementTenuringThresholdForSurvivorLimit=0
    sun.gc.policy.desiredSurvivorSize=0
    sun.gc.policy.edenSize=34078720
    sun.gc.policy.freeSpace=68157440
    sun.gc.policy.fullFollowsScavenge=0
    sun.gc.policy.gcTimeLimitExceeded=0
    sun.gc.policy.generations=3
    sun.gc.policy.increaseOldGenForThroughput=0
    sun.gc.policy.increaseYoungGenForThroughput=0
    sun.gc.policy.incrementTenuringThresholdForGcCost=0
    sun.gc.policy.liveAtLastFullGc=34078720
    sun.gc.policy.liveSpace=0
    sun.gc.policy.majorCollectionSlope=0
    sun.gc.policy.majorGcCost=0
    sun.gc.policy.majorPauseOldSlope=0
    sun.gc.policy.majorPauseYoungSlope=0
    sun.gc.policy.maxTenuringThreshold=15
    sun.gc.policy.minorCollectionSlope=0
    sun.gc.policy.minorGcCost=0
    sun.gc.policy.minorPauseOldSlope=0
    sun.gc.policy.minorPauseTime=0
    sun.gc.policy.minorPauseYoungSlope=0
    sun.gc.policy.mutatorCost=1
    sun.gc.policy.name="ParScav:MSC"
    sun.gc.policy.oldCapacity=134217728
    sun.gc.policy.oldEdenSize=34078720
    sun.gc.policy.oldPromoSize=34078720
    sun.gc.policy.promoSize=34078720
    sun.gc.policy.promoted=0
    sun.gc.policy.scavengeSkipped=0
    sun.gc.policy.survived=0
    sun.gc.policy.survivorOverflowed=0
    sun.gc.policy.tenuringThreshold=15
    sun.gc.policy.youngCapacity=39321600
    sun.gc.tlab.alloc=0
    sun.gc.tlab.allocThreads=0
    sun.gc.tlab.fastWaste=0
    sun.gc.tlab.fills=0
    sun.gc.tlab.gcWaste=0
    sun.gc.tlab.maxFastWaste=0
    sun.gc.tlab.maxFills=0
    sun.gc.tlab.maxGcWaste=0
    sun.gc.tlab.maxSlowAlloc=0
    sun.gc.tlab.maxSlowWaste=0
    sun.gc.tlab.slowAlloc=0
    sun.gc.tlab.slowWaste=0
    sun.os.hrt.frequency=1000000000
    sun.os.hrt.ticks=714050340882
    sun.perfdata.majorVersion=2
    sun.perfdata.minorVersion=0
    sun.perfdata.overflow=0
    sun.perfdata.size=32768
    sun.perfdata.timestamp=553597942
    sun.perfdata.used=18848
    sun.property.sun.boot.class.path="/Library/Java/JavaVirtualMachines/jdk1.8.0_92.jdk/Contents/Home/jre/lib/resources.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_92.jdk/Contents/Home/jre/lib/rt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_92.jdk/Contents/Home/jre/lib/sunrsasign.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_92.jdk/Contents/Home/jre/lib/jsse.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_92.jdk/Contents/Home/jre/lib/jce.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_92.jdk/Contents/Home/jre/lib/charsets.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_92.jdk/Contents/Home/jre/lib/jfr.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_92.jdk/Contents/Home/jre/classes"
    sun.property.sun.boot.library.path="/Library/Java/JavaVirtualMachines/jdk1.8.0_92.jdk/Contents/Home/jre/lib"
    sun.rt._sync_ContendedLockAttempts=0
    sun.rt._sync_Deflations=3
    sun.rt._sync_EmptyNotifications=0
    sun.rt._sync_FailedSpins=0
    sun.rt._sync_FutileWakeups=0
    sun.rt._sync_Inflations=5
    sun.rt._sync_MonExtant=128
    sun.rt._sync_MonInCirculation=0
    sun.rt._sync_MonScavenged=0
    sun.rt._sync_Notifications=2
    sun.rt._sync_Parks=2
    sun.rt._sync_PrivateA=0
    sun.rt._sync_PrivateB=0
    sun.rt._sync_SlowEnter=0
    sun.rt._sync_SlowExit=0
    sun.rt._sync_SlowNotify=0
    sun.rt._sync_SlowNotifyAll=0
    sun.rt._sync_SuccessfulSpins=0
    sun.rt.applicationTime=429558101791
    sun.rt.createVmBeginTime=1555054870552
    sun.rt.createVmEndTime=1555054871042
    sun.rt.internalVersion="Java HotSpot(TM) 64-Bit Server VM (25.92-b14) for bsd-amd64 JRE (1.8.0_92-b14), built on Mar 31 2016 21:23:14 by "java_re" with gcc 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00)"
    sun.rt.interruptedBeforeIO=0
    sun.rt.interruptedDuringIO=0
    sun.rt.javaCommand="com.jvm.memory.MyTest5"
    sun.rt.jvmCapabilities="1100000000000000000000000000000000000000000000000000000000000000"
    sun.rt.jvmVersion=425459726
    sun.rt.safepointSyncTime=676359
    sun.rt.safepointTime=1471726
    sun.rt.safepoints=7
    sun.rt.threadInterruptSignaled=0
    sun.rt.vmInitDoneTime=1555054870846
    sun.threads.vmOperationTime=57519
    sun.urlClassLoader.readClassBytesTime=1087499
    sun.zip.zipFile.openTime=77754125
    sun.zip.zipFiles=19
    xiongweideMacBook-Pro:CoffeeMachineClient xiongwei$ 

    真的太多了。。

    jcmd pid VM.uptime:查看JVM的启动时长。

    jcmd pid GC.class_histogram:查看系统中类的统计信息。

    xiongweideMacBook-Pro:CoffeeMachineClient xiongwei$ jcmd 97595 GC.class_histogram
    97595:
    
     num     #instances         #bytes  class name
    ----------------------------------------------
       1:          3329         238320  [C
       2:           441         128256  [B
       3:          3308          79392  java.lang.String
       4:           591          67184  java.lang.Class
       5:           586          35408  [Ljava.lang.Object;
       6:           631          25240  java.util.LinkedHashMap$Entry
       7:           287          13088  [Ljava.lang.String;
       8:           360          11520  java.util.HashMap$Node
       9:            22           8480  [Ljava.util.HashMap$Node;
      10:           118           7040  [I
      11:            98           6272  java.net.URL
      12:            79           5688  java.lang.reflect.Field
      13:           256           4096  java.lang.Integer
      14:            99           3960  java.lang.ref.SoftReference
      15:           116           3712  java.util.Hashtable$Entry
      16:            67           2680  java.lang.ref.Finalizer
      17:             7           2632  java.lang.Thread
      18:            74           2368  java.util.concurrent.ConcurrentHashMap$Node
      19:            45           2160  sun.misc.URLClassPath$JarLoader
      20:            39           1872  sun.util.locale.LocaleObjectCache$CacheEntry
      21:            22           1760  [Ljava.util.WeakHashMap$Entry;
      22:            16           1664  [Ljava.util.concurrent.ConcurrentHashMap$Node;
      23:             1           1520  [[B
      24:            18           1440  java.lang.reflect.Constructor
      25:            28           1344  java.util.HashMap
      26:            23           1288  sun.nio.cs.UTF_8$Encoder
      27:            20           1280  java.util.concurrent.ConcurrentHashMap
      28:            13           1248  java.util.jar.JarFile$JarFileEntry
      29:            19           1216  java.util.jar.JarFile
      30:             8           1120  [Ljava.util.Hashtable$Entry;
      31:             2           1064  [Ljava.lang.invoke.MethodHandle;
      32:            44           1056  java.io.ExpiringCache$Entry
      33:            22           1056  java.util.WeakHashMap
      34:             1           1040  [Ljava.lang.Integer;
      35:            26           1040  java.io.ObjectStreamField
      36:            18           1008  java.lang.Class$ReflectionData
      37:            29            928  java.lang.ref.ReferenceQueue
      38:            15            840  java.util.zip.ZipFile$ZipFileInputStream
      39:            48            768  java.lang.Object
      40:            19            760  sun.util.locale.BaseLocale$Key
      41:            12            672  java.util.zip.ZipFile$ZipFileInflaterInputStream
      42:             8            640  [S
      43:            19            608  java.util.Locale
      44:            19            608  java.util.zip.ZipCoder
      45:            19            608  sun.util.locale.BaseLocale
      46:            12            576  java.util.zip.Inflater
      47:            17            544  java.io.File
      48:            31            496  java.lang.ref.ReferenceQueue$Lock
      49:             8            456  [Ljava.lang.reflect.Field;
      50:            19            456  java.util.ArrayDeque
      51:            19            456  java.util.Locale$LocaleKey
      52:            11            440  java.security.AccessControlContext
      53:             1            384  java.lang.ref.Finalizer$FinalizerThread
      54:             6            384  java.nio.DirectByteBuffer
      55:            16            384  sun.misc.MetaIndex
      56:             1            376  java.lang.ref.Reference$ReferenceHandler
      57:            15            360  java.util.LinkedList$Node
      58:             6            336  java.nio.DirectLongBufferU
      59:            10            320  java.lang.OutOfMemoryError
      60:            10            288  [Ljava.io.ObjectStreamField;
      61:             9            288  java.util.LinkedList
      62:            12            288  java.util.zip.ZStreamRef
      63:             7            280  java.util.WeakHashMap$Entry
      64:             5            280  sun.util.calendar.ZoneInfo
      65:             8            256  java.io.FileDescriptor
      66:             8            256  java.util.Vector
      67:            12            240  [Ljava.lang.Class;
      68:             5            240  java.util.Hashtable
      69:             2            216  [J
      70:             9            216  [Ljava.lang.reflect.Constructor;
      71:             9            216  java.util.ArrayList
      72:             9            216  sun.reflect.NativeConstructorAccessorImpl
      73:             2            160  [Ljava.lang.ThreadLocal$ThreadLocalMap$Entry;
      74:             5            160  java.io.FileInputStream
      75:             4            160  java.security.ProtectionDomain
      76:             5            160  sun.util.locale.provider.LocaleProviderAdapter$Type
      77:             3            144  java.util.Properties
      78:             6            144  sun.misc.PerfCounter
      79:             3            144  sun.misc.URLClassPath
      80:             9            144  sun.reflect.DelegatingConstructorAccessorImpl
      81:             2            128  java.io.ExpiringCache$1
      82:             4            128  java.lang.ThreadLocal$ThreadLocalMap$Entry
      83:             4            128  java.security.CodeSource
      84:             4            128  java.util.Stack
      85:             1            120  [[Ljava.lang.String;
      86:             5            120  java.util.Collections$UnmodifiableRandomAccessList
      87:             2            112  java.util.LinkedHashMap
      88:             2            112  java.util.ResourceBundle$CacheKey
      89:             3             96  java.io.FileOutputStream
      90:             2             96  java.lang.ThreadGroup
      91:             2             96  java.nio.HeapByteBuffer
      92:             2             96  java.util.ResourceBundle$BundleReference
      93:             1             96  sun.misc.Launcher$AppClassLoader
      94:             2             96  sun.nio.cs.StreamEncoder
      95:             1             88  java.lang.reflect.Method
      96:             1             88  sun.misc.Launcher$ExtClassLoader
      97:             2             80  java.io.BufferedWriter
      98:             2             80  java.io.ExpiringCache
      99:             2             80  sun.nio.cs.UTF_8$Decoder
     100:             3             72  java.lang.RuntimePermission
     101:             3             72  java.util.Arrays$ArrayList
     102:             3             72  java.util.Collections$SynchronizedSet
     103:             1             72  java.util.ResourceBundle$RBClassLoader
     104:             3             72  java.util.concurrent.atomic.AtomicLong
     105:             3             72  sun.misc.Signal
     106:             1             72  sun.util.locale.provider.JRELocaleProviderAdapter
     107:             2             64  [Ljava.lang.Thread;
     108:             4             64  [Ljava.security.Principal;
     109:             2             64  java.io.PrintStream
     110:             2             64  java.lang.ClassValue$Entry
     111:             2             64  java.lang.StringCoding$StringDecoder
     112:             2             64  java.lang.StringCoding$StringEncoder
     113:             2             64  java.lang.VirtualMachineError
     114:             2             64  java.lang.ref.ReferenceQueue$Null
     115:             4             64  java.security.ProtectionDomain$Key
     116:             4             64  java.util.HashSet
     117:             2             64  java.util.ResourceBundle$LoaderReference
     118:             1             56  java.lang.Package
     119:             2             48  java.io.BufferedOutputStream
     120:             2             48  java.io.File$PathStatus
     121:             2             48  java.io.OutputStreamWriter
     122:             3             48  java.lang.ThreadLocal
     123:             2             48  java.lang.ThreadLocal$ThreadLocalMap
     124:             2             48  java.nio.charset.CoderResult
     125:             3             48  java.nio.charset.CodingErrorAction
     126:             2             48  sun.misc.JarIndex
     127:             2             48  sun.misc.NativeSignalHandler
     128:             3             48  sun.net.www.protocol.jar.Handler
     129:             1             48  sun.util.locale.provider.LocaleResources$ResourceReference
     130:             1             48  sun.util.resources.TimeZoneNames
     131:             1             48  sun.util.resources.en.TimeZoneNames_en
     132:             1             40  [Lsun.util.locale.provider.LocaleProviderAdapter$Type;
     133:             1             40  java.io.BufferedInputStream
     134:             1             40  java.lang.ClassLoader$NativeLibrary
     135:             1             40  java.util.ResourceBundle$1
     136:             1             40  sun.nio.cs.StandardCharsets$Aliases
     137:             1             40  sun.nio.cs.StandardCharsets$Cache
     138:             1             40  sun.nio.cs.StandardCharsets$Classes
     139:             1             32  [Ljava.lang.OutOfMemoryError;
     140:             2             32  [Ljava.lang.StackTraceElement;
     141:             1             32  [Ljava.lang.ThreadGroup;
     142:             1             32  java.io.FilePermission
     143:             1             32  java.io.UnixFileSystem
     144:             1             32  java.lang.ArithmeticException
     145:             2             32  java.lang.Boolean
     146:             1             32  java.lang.NullPointerException
     147:             2             32  java.nio.ByteOrder
     148:             1             32  java.security.BasicPermissionCollection
     149:             1             32  java.security.Permissions
     150:             2             32  java.util.LinkedHashMap$LinkedKeySet
     151:             2             32  java.util.concurrent.atomic.AtomicInteger
     152:             1             32  java.util.concurrent.atomic.AtomicReferenceFieldUpdater$AtomicReferenceFieldUpdaterImpl
     153:             1             32  sun.nio.cs.StandardCharsets
     154:             1             32  sun.util.locale.provider.LocaleResources
     155:             1             32  sun.util.locale.provider.LocaleServiceProviderPool
     156:             1             24  [Ljava.io.File$PathStatus;
     157:             1             24  [Ljava.lang.ClassValue$Entry;
     158:             1             24  [Ljava.lang.reflect.Method;
     159:             1             24  [Lsun.launcher.LauncherHelper;
     160:             1             24  java.io.FilePermissionCollection
     161:             1             24  java.lang.ClassValue$Version
     162:             1             24  java.lang.StringBuilder
     163:             1             24  java.lang.invoke.MethodHandleImpl$4
     164:             1             24  java.lang.reflect.ReflectPermission
     165:             1             24  java.util.BitSet
     166:             1             24  java.util.Collections$EmptyMap
     167:             1             24  java.util.Collections$SetFromMap
     168:             1             24  java.util.Locale$Cache
     169:             1             24  java.util.ResourceBundle$Control$CandidateListCache
     170:             1             24  sun.launcher.LauncherHelper
     171:             1             24  sun.misc.URLClassPath$FileLoader
     172:             1             24  sun.nio.cs.ISO_8859_1
     173:             1             24  sun.nio.cs.US_ASCII
     174:             1             24  sun.nio.cs.UTF_16
     175:             1             24  sun.nio.cs.UTF_16BE
     176:             1             24  sun.nio.cs.UTF_16LE
     177:             1             24  sun.nio.cs.UTF_8
     178:             1             24  sun.util.locale.BaseLocale$Cache
     179:             1             24  sun.util.locale.provider.TimeZoneNameProviderImpl
     180:             1             16  [Ljava.lang.Throwable;
     181:             1             16  [Ljava.security.cert.Certificate;
     182:             1             16  java.io.FileDescriptor$1
     183:             1             16  java.lang.CharacterDataLatin1
     184:             1             16  java.lang.ClassValue$Identity
     185:             1             16  java.lang.Runtime
     186:             1             16  java.lang.String$CaseInsensitiveComparator
     187:             1             16  java.lang.System$2
     188:             1             16  java.lang.Terminator$1
     189:             1             16  java.lang.invoke.MemberName$Factory
     190:             1             16  java.lang.invoke.MethodHandleImpl$2
     191:             1             16  java.lang.invoke.MethodHandleImpl$3
     192:             1             16  java.lang.ref.Reference$1
     193:             1             16  java.lang.ref.Reference$Lock
     194:             1             16  java.lang.reflect.ReflectAccess
     195:             1             16  java.net.URLClassLoader$7
     196:             1             16  java.nio.Bits$1
     197:             1             16  java.nio.charset.CoderResult$1
     198:             1             16  java.nio.charset.CoderResult$2
     199:             1             16  java.security.ProtectionDomain$2
     200:             1             16  java.security.ProtectionDomain$JavaSecurityAccessImpl
     201:             1             16  java.util.Collections$EmptyIterator
     202:             1             16  java.util.Collections$EmptyList
     203:             1             16  java.util.Collections$EmptySet
     204:             1             16  java.util.Hashtable$EntrySet
     205:             1             16  java.util.ResourceBundle$Control
     206:             1             16  java.util.WeakHashMap$KeySet
     207:             1             16  java.util.concurrent.atomic.AtomicBoolean
     208:             1             16  java.util.jar.JavaUtilJarAccessImpl
     209:             1             16  java.util.zip.ZipFile$1
     210:             1             16  sun.misc.Launcher
     211:             1             16  sun.misc.Launcher$Factory
     212:             1             16  sun.misc.Perf
     213:             1             16  sun.misc.Unsafe
     214:             1             16  sun.net.www.protocol.file.Handler
     215:             1             16  sun.reflect.ReflectionFactory
     216:             1             16  sun.util.calendar.Gregorian
     217:             1             16  sun.util.locale.provider.AuxLocaleProviderAdapter$NullProvider
     218:             1             16  sun.util.locale.provider.SPILocaleProviderAdapter
     219:             1             16  sun.util.locale.provider.TimeZoneNameUtility$TimeZoneNameGetter
     220:             1             16  sun.util.resources.LocaleData
     221:             1             16  sun.util.resources.LocaleData$LocaleDataResourceBundleControl
    Total         11547         692336
    xiongweideMacBook-Pro:CoffeeMachineClient xiongwei$ 

    jcmd pid Thread.print:查看线程堆栈信息。

    xiongweideMacBook-Pro:CoffeeMachineClient xiongwei$ jcmd 97595 Thread.print
    97595:
    2019-04-12 15:58:30
    Full thread dump Java HotSpot(TM) 64-Bit Server VM (25.92-b14 mixed mode):
    
    "Attach Listener" #9 daemon prio=9 os_prio=31 tid=0x00007fb6d3906800 nid=0x3803 waiting on condition [0x0000000000000000]
       java.lang.Thread.State: RUNNABLE
    
    "Service Thread" #8 daemon prio=9 os_prio=31 tid=0x00007fb6d300c000 nid=0x3603 runnable [0x0000000000000000]
       java.lang.Thread.State: RUNNABLE
    
    "C1 CompilerThread2" #7 daemon prio=9 os_prio=31 tid=0x00007fb6d281e800 nid=0x4503 waiting on condition [0x0000000000000000]
       java.lang.Thread.State: RUNNABLE
    
    "C2 CompilerThread1" #6 daemon prio=9 os_prio=31 tid=0x00007fb6d2809800 nid=0x3503 waiting on condition [0x0000000000000000]
       java.lang.Thread.State: RUNNABLE
    
    "C2 CompilerThread0" #5 daemon prio=9 os_prio=31 tid=0x00007fb6d280c800 nid=0x3403 waiting on condition [0x0000000000000000]
       java.lang.Thread.State: RUNNABLE
    
    "Signal Dispatcher" #4 daemon prio=9 os_prio=31 tid=0x00007fb6d300b000 nid=0x3303 runnable [0x0000000000000000]
       java.lang.Thread.State: RUNNABLE
    
    "Finalizer" #3 daemon prio=8 os_prio=31 tid=0x00007fb6d201f000 nid=0x4f03 in Object.wait() [0x0000700008a96000]
       java.lang.Thread.State: WAITING (on object monitor)
        at java.lang.Object.wait(Native Method)
        - waiting on <0x0000000740010020> (a java.lang.ref.ReferenceQueue$Lock)
        at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:143)
        - locked <0x0000000740010020> (a java.lang.ref.ReferenceQueue$Lock)
        at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:164)
        at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:209)
    
    "Reference Handler" #2 daemon prio=10 os_prio=31 tid=0x00007fb6d301f000 nid=0x2b03 in Object.wait() [0x0000700008993000]
       java.lang.Thread.State: WAITING (on object monitor)
        at java.lang.Object.wait(Native Method)
        - waiting on <0x0000000740010010> (a java.lang.ref.Reference$Lock)
        at java.lang.Object.wait(Object.java:502)
        at java.lang.ref.Reference.tryHandlePending(Reference.java:191)
        - locked <0x0000000740010010> (a java.lang.ref.Reference$Lock)
        at java.lang.ref.Reference$ReferenceHandler.run(Reference.java:153)
    
    "main" #1 prio=5 os_prio=31 tid=0x00007fb6d3805800 nid=0x2803 waiting on condition [0x0000700008381000]
       java.lang.Thread.State: TIMED_WAITING (sleeping)
        at java.lang.Thread.sleep(Native Method)
        at com.jvm.memory.MyTest5.main(MyTest5.java:8)
    
    "VM Thread" os_prio=31 tid=0x00007fb6d2805000 nid=0x5103 runnable 
    
    "GC task thread#0 (ParallelGC)" os_prio=31 tid=0x00007fb6d3811800 nid=0x1e07 runnable 
    
    "GC task thread#1 (ParallelGC)" os_prio=31 tid=0x00007fb6d3812000 nid=0x2103 runnable 
    
    "GC task thread#2 (ParallelGC)" os_prio=31 tid=0x00007fb6d2000800 nid=0x2a03 runnable 
    
    "GC task thread#3 (ParallelGC)" os_prio=31 tid=0x00007fb6d3812800 nid=0x5303 runnable 
    
    "VM Periodic Task Thread" os_prio=31 tid=0x00007fb6d200a800 nid=0x3703 waiting on condition 
    
    JNI global references: 6

    貌似上面这个在jconsole和jvisualvm可视化的工具中都能看到,也就是GUI工具看到的也是集成了jcmd的命令工具了,关于线程貌似之前我们写过一个死锁的例子,这里再运行一下这个程序来用这个命令观测一下:

    xiongweideMacBook-Pro:CoffeeMachineClient xiongwei$ jps -l
    98017 com.jvm.memory.MyTest3
    96336 org.gradle.launcher.daemon.bootstrap.GradleDaemon
    94336 
    98016 org.jetbrains.jps.cmdline.Launcher
    98024 sun.tools.jps.Jps
    17418 
    96495 org.gradle.launcher.daemon.bootstrap.GradleDaemon
    xiongweideMacBook-Pro:CoffeeMachineClient xiongwei$ jcmd 98017 Thread.print
    98017:
    2019-04-12 16:02:00
    Full thread dump Java HotSpot(TM) 64-Bit Server VM (25.92-b14 mixed mode):
    
    "Attach Listener" #12 daemon prio=9 os_prio=31 tid=0x00007fc497931000 nid=0x4203 waiting on condition [0x0000000000000000]
       java.lang.Thread.State: RUNNABLE
    
    "DestroyJavaVM" #11 prio=5 os_prio=31 tid=0x00007fc497829800 nid=0x2803 waiting on condition [0x0000000000000000]
       java.lang.Thread.State: RUNNABLE
    
    "Thread-B" #10 prio=5 os_prio=31 tid=0x00007fc4968fa000 nid=0x4103 waiting for monitor entry [0x00007000014e0000]
       java.lang.Thread.State: BLOCKED (on object monitor)
        at com.jvm.memory.A.method(MyTest3.java:17)
        - waiting to lock <0x00000007958c2f10> (a java.lang.Class for com.jvm.memory.A)
        at com.jvm.memory.B.method(MyTest3.java:35)
        - locked <0x0000000795a0fcb0> (a java.lang.Class for com.jvm.memory.B)
        at com.jvm.memory.MyTest3.lambda$main$1(MyTest3.java:10)
        at com.jvm.memory.MyTest3$$Lambda$2/1989780873.run(Unknown Source)
        at java.lang.Thread.run(Thread.java:745)
    
    "Thread-A" #9 prio=5 os_prio=31 tid=0x00007fc4968f9800 nid=0x4703 waiting for monitor entry [0x00007000013dd000]
       java.lang.Thread.State: BLOCKED (on object monitor)
        at com.jvm.memory.B.method(MyTest3.java:31)
        - waiting to lock <0x0000000795a0fcb0> (a java.lang.Class for com.jvm.memory.B)
        at com.jvm.memory.A.method(MyTest3.java:21)
        - locked <0x00000007958c2f10> (a java.lang.Class for com.jvm.memory.A)
        at com.jvm.memory.MyTest3.lambda$main$0(MyTest3.java:6)
        at com.jvm.memory.MyTest3$$Lambda$1/2093631819.run(Unknown Source)
        at java.lang.Thread.run(Thread.java:745)
    
    "Service Thread" #8 daemon prio=9 os_prio=31 tid=0x00007fc49680c800 nid=0x4903 runnable [0x0000000000000000]
       java.lang.Thread.State: RUNNABLE
    
    "C1 CompilerThread2" #7 daemon prio=9 os_prio=31 tid=0x00007fc496804800 nid=0x3d03 waiting on condition [0x0000000000000000]
       java.lang.Thread.State: RUNNABLE
    
    "C2 CompilerThread1" #6 daemon prio=9 os_prio=31 tid=0x00007fc49703d800 nid=0x4b03 waiting on condition [0x0000000000000000]
       java.lang.Thread.State: RUNNABLE
    
    "C2 CompilerThread0" #5 daemon prio=9 os_prio=31 tid=0x00007fc497017000 nid=0x3a03 waiting on condition [0x0000000000000000]
       java.lang.Thread.State: RUNNABLE
    
    "Signal Dispatcher" #4 daemon prio=9 os_prio=31 tid=0x00007fc498031000 nid=0x3803 runnable [0x0000000000000000]
       java.lang.Thread.State: RUNNABLE
    
    "Finalizer" #3 daemon prio=8 os_prio=31 tid=0x00007fc496820000 nid=0x5003 in Object.wait() [0x0000700000c45000]
       java.lang.Thread.State: WAITING (on object monitor)
        at java.lang.Object.wait(Native Method)
        - waiting on <0x0000000795588ee0> (a java.lang.ref.ReferenceQueue$Lock)
        at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:143)
        - locked <0x0000000795588ee0> (a java.lang.ref.ReferenceQueue$Lock)
        at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:164)
        at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:209)
    
    "Reference Handler" #2 daemon prio=10 os_prio=31 tid=0x00007fc497808000 nid=0x5103 in Object.wait() [0x0000700000b42000]
       java.lang.Thread.State: WAITING (on object monitor)
        at java.lang.Object.wait(Native Method)
        - waiting on <0x0000000795586b50> (a java.lang.ref.Reference$Lock)
        at java.lang.Object.wait(Object.java:502)
        at java.lang.ref.Reference.tryHandlePending(Reference.java:191)
        - locked <0x0000000795586b50> (a java.lang.ref.Reference$Lock)
        at java.lang.ref.Reference$ReferenceHandler.run(Reference.java:153)
    
    "VM Thread" os_prio=31 tid=0x00007fc498028800 nid=0x2c03 runnable 
    
    "GC task thread#0 (ParallelGC)" os_prio=31 tid=0x00007fc497009000 nid=0x2207 runnable 
    
    "GC task thread#1 (ParallelGC)" os_prio=31 tid=0x00007fc497009800 nid=0x1f03 runnable 
    
    "GC task thread#2 (ParallelGC)" os_prio=31 tid=0x00007fc49700a000 nid=0x2a03 runnable 
    
    "GC task thread#3 (ParallelGC)" os_prio=31 tid=0x00007fc49700a800 nid=0x5403 runnable 
    
    "VM Periodic Task Thread" os_prio=31 tid=0x00007fc497812000 nid=0x4803 waiting on condition 
    
    JNI global references: 309
    
    
    Found one Java-level deadlock:
    =============================
    "Thread-B":
      waiting to lock monitor 0x00007fc4980308a8 (object 0x00000007958c2f10, a java.lang.Class),
      which is held by "Thread-A"
    "Thread-A":
      waiting to lock monitor 0x00007fc49802e018 (object 0x0000000795a0fcb0, a java.lang.Class),
      which is held by "Thread-B"
    
    Java stack information for the threads listed above:
    ===================================================
    "Thread-B":
        at com.jvm.memory.A.method(MyTest3.java:17)
        - waiting to lock <0x00000007958c2f10> (a java.lang.Class for com.jvm.memory.A)
        at com.jvm.memory.B.method(MyTest3.java:35)
        - locked <0x0000000795a0fcb0> (a java.lang.Class for com.jvm.memory.B)
        at com.jvm.memory.MyTest3.lambda$main$1(MyTest3.java:10)
        at com.jvm.memory.MyTest3$$Lambda$2/1989780873.run(Unknown Source)
        at java.lang.Thread.run(Thread.java:745)
    "Thread-A":
        at com.jvm.memory.B.method(MyTest3.java:31)
        - waiting to lock <0x0000000795a0fcb0> (a java.lang.Class for com.jvm.memory.B)
        at com.jvm.memory.A.method(MyTest3.java:21)
        - locked <0x00000007958c2f10> (a java.lang.Class for com.jvm.memory.A)
        at com.jvm.memory.MyTest3.lambda$main$0(MyTest3.java:6)
        at com.jvm.memory.MyTest3$$Lambda$1/2093631819.run(Unknown Source)
        at java.lang.Thread.run(Thread.java:745)
    
    Found 1 deadlock.

    如我们之前在jconsole或jvisualvm看到的一样,之所以要学习命令行工具是因为有时候可能不能使用GUI工具,这时命令行工具就可以发挥其作用了。

    jcmd pid GC.heap_jump filename:导出Heap dump文件,导出的文件可以通过jvisualvm查看。

    还是回到MyTest5这个例子:

    此时在桌在上就可以看到这个转储文件了:

    我们可以用jvisualvm看能否正常打开它:

    木问题的~~

    jcmd pid VM.system_properties:查看JVM的属性信息。

    xiongweideMacBook-Pro:CoffeeMachineClient xiongwei$ jcmd 98073 VM.system_properties
    98073:
    #Fri Apr 12 16:12:20 CST 2019
    java.runtime.name=Java(TM) SE Runtime Environment
    sun.boot.library.path=/Library/Java/JavaVirtualMachines/jdk1.8.0_92.jdk/Contents/Home/jre/lib
    java.vm.version=25.92-b14
    gopherProxySet=false
    java.vm.vendor=Oracle Corporation
    java.vendor.url=http://java.oracle.com/
    path.separator=:
    java.vm.name=Java HotSpot(TM) 64-Bit Server VM
    file.encoding.pkg=sun.io
    user.country=CN
    sun.java.launcher=SUN_STANDARD
    sun.os.patch.level=unknown
    java.vm.specification.name=Java Virtual Machine Specification
    user.dir=/Users/xiongwei/Documents/workspace/IntelliJSpace/jvm_lectue
    java.runtime.version=1.8.0_92-b14
    java.awt.graphicsenv=sun.awt.CGraphicsEnvironment
    java.endorsed.dirs=/Library/Java/JavaVirtualMachines/jdk1.8.0_92.jdk/Contents/Home/jre/lib/endorsed
    os.arch=x86_64
    java.io.tmpdir=/var/folders/80/ckcy6rp51vg303j_q084yc7w0000gn/T/
    line.separator=
    
    java.vm.specification.vendor=Oracle Corporation
    os.name=Mac OS X
    sun.jnu.encoding=UTF-8
    java.library.path=/Users/xiongwei/Library/Java/Extensions:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java:.
    java.specification.name=Java Platform API Specification
    java.class.version=52.0
    sun.management.compiler=HotSpot 64-Bit Tiered Compilers
    os.version=10.13.6
    user.home=/Users/xiongwei
    user.timezone=Asia/Shanghai
    java.awt.printerjob=sun.lwawt.macosx.CPrinterJob
    file.encoding=UTF-8
    java.specification.version=1.8
    user.name=xiongwei
    java.class.path=/Library/Java/JavaVirtualMachines/jdk1.8.0_92.jdk/Contents/Home/jre/lib/charsets.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_92.jdk/Contents/Home/jre/lib/deploy.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_92.jdk/Contents/Home/jre/lib/ext/cldrdata.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_92.jdk/Contents/Home/jre/lib/ext/dnsns.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_92.jdk/Contents/Home/jre/lib/ext/jaccess.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_92.jdk/Contents/Home/jre/lib/ext/jfxrt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_92.jdk/Contents/Home/jre/lib/ext/localedata.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_92.jdk/Contents/Home/jre/lib/ext/nashorn.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_92.jdk/Contents/Home/jre/lib/ext/sunec.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_92.jdk/Contents/Home/jre/lib/ext/sunjce_provider.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_92.jdk/Contents/Home/jre/lib/ext/sunpkcs11.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_92.jdk/Contents/Home/jre/lib/ext/zipfs.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_92.jdk/Contents/Home/jre/lib/javaws.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_92.jdk/Contents/Home/jre/lib/jce.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_92.jdk/Contents/Home/jre/lib/jfr.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_92.jdk/Contents/Home/jre/lib/jfxswt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_92.jdk/Contents/Home/jre/lib/jsse.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_92.jdk/Contents/Home/jre/lib/management-agent.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_92.jdk/Contents/Home/jre/lib/plugin.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_92.jdk/Contents/Home/jre/lib/resources.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_92.jdk/Contents/Home/jre/lib/rt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_92.jdk/Contents/Home/lib/ant-javafx.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_92.jdk/Contents/Home/lib/dt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_92.jdk/Contents/Home/lib/javafx-mx.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_92.jdk/Contents/Home/lib/jconsole.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_92.jdk/Contents/Home/lib/packager.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_92.jdk/Contents/Home/lib/sa-jdi.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_92.jdk/Contents/Home/lib/tools.jar:/Users/xiongwei/Documents/workspace/IntelliJSpace/jvm_lectue/out/production/classes:/Users/xiongwei/.gradle/caches/modules-2/files-2.1/mysql/mysql-connector-java/5.1.34/46deba4adbdb4967367b013cbc67b7f7373da60a/mysql-connector-java-5.1.34.jar:/Users/xiongwei/.gradle/caches/modules-2/files-2.1/cglib/cglib/3.2.0/bced5c83ed985c080a24dc5a42b0ca631556f413/cglib-3.2.0.jar:/Users/xiongwei/.gradle/caches/modules-2/files-2.1/org.ow2.asm/asm/5.0.3/dcc2193db20e19e1feca8b1240dbbc4e190824fa/asm-5.0.3.jar:/Users/xiongwei/.gradle/caches/modules-2/files-2.1/org.apache.ant/ant/1.9.4/6d473e8653d952045f550f4ef225a9591b79094a/ant-1.9.4.jar:/Users/xiongwei/.gradle/caches/modules-2/files-2.1/org.apache.ant/ant-launcher/1.9.4/334b62cb4be0432769679e8b94e83f8fd5ed395c/ant-launcher-1.9.4.jar
    java.vm.specification.version=1.8
    sun.java.command=com.jvm.memory.MyTest5
    java.home=/Library/Java/JavaVirtualMachines/jdk1.8.0_92.jdk/Contents/Home/jre
    sun.arch.data.model=64
    user.language=zh
    java.specification.vendor=Oracle Corporation
    user.language.format=en
    awt.toolkit=sun.lwawt.macosx.LWCToolkit
    java.vm.info=mixed mode
    java.version=1.8.0_92
    java.ext.dirs=/Users/xiongwei/Library/Java/Extensions:/Library/Java/JavaVirtualMachines/jdk1.8.0_92.jdk/Contents/Home/jre/lib/ext:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java
    sun.boot.class.path=/Library/Java/JavaVirtualMachines/jdk1.8.0_92.jdk/Contents/Home/jre/lib/resources.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_92.jdk/Contents/Home/jre/lib/rt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_92.jdk/Contents/Home/jre/lib/sunrsasign.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_92.jdk/Contents/Home/jre/lib/jsse.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_92.jdk/Contents/Home/jre/lib/jce.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_92.jdk/Contents/Home/jre/lib/charsets.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_92.jdk/Contents/Home/jre/lib/jfr.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_92.jdk/Contents/Home/jre/classes
    java.vendor=Oracle Corporation
    file.separator=/
    java.vendor.url.bug=http://bugreport.sun.com/bugreport/
    sun.io.unicode.encoding=UnicodeBig
    sun.cpu.endian=little
    sun.cpu.isalist=

    jcmd pid VM.version:查看JVM的版本信息。

    jcmd pid VM.command_line:查看JVM启动的命令行参数信息。

    以上就是关于jcmd的一些重要参数的演练,目前是纯练,记录下来待未来有需要时再回来翻阅。

  • 相关阅读:
    Mysql常见索引介绍
    Mysql字段修饰符(约束)
    使用select和show命令查看mysql数据库系统信息
    Mysql5.7数据库介绍
    对Mysql数据表本身进行操作
    各种修改Mysql字符集
    Mysql的安全配置向导命令mysql_secure_installation
    firewalld介绍
    CentOS7使用yum安装mysql5.7
    利用ASP.NET一般处理程序动态生成Web图像(转)
  • 原文地址:https://www.cnblogs.com/webor2006/p/10669472.html
Copyright © 2011-2022 走看看