美文网首页
JDK升级&jmap等命令没法使用解决

JDK升级&jmap等命令没法使用解决

作者: 南岩飞雪 | 来源:发表于2019-04-03 19:45 被阅读0次

JDK升级操作

  • sudo yum install java-1.8.0-openjdk-devel.x86_64
  • 修改/etc/profile --编辑用户目录下(root用户的目录为/root)的.bashrc或.profile文件。如果你想在所有用户的shell下都生效,就编辑/etc/profile文件。
    JAVA_HOME=/usr/lib/jvm/java-openjdk
  • source /etc/profile

JDK升级后,jmap等命令无法使用

  • 报错
Heap Usage:
Exception in thread "main" java.lang.reflect.InvocationTargetException
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  at java.lang.reflect.Method.invoke(Method.java:498)
  at sun.tools.jmap.JMap.runTool(JMap.java:201)
  at sun.tools.jmap.JMap.main(JMap.java:130)
Caused by: java.lang.RuntimeException: unknown CollectedHeap type : class sun.jvm.hotspot.gc_interface.CollectedHeap
  at sun.jvm.hotspot.tools.HeapSummary.run(HeapSummary.java:157)
  at sun.jvm.hotspot.tools.Tool.startInternal(Tool.java:260)
  at sun.jvm.hotspot.tools.Tool.start(Tool.java:223)
  at sun.jvm.hotspot.tools.Tool.execute(Tool.java:118)
  at sun.jvm.hotspot.tools.HeapSummary.main(HeapSummary.java:50)
  ... 6 more

解决

申请yum源的白名单
sudo yum install java-1.8.0-openjdk-..x86_64
sudo yum install -y java-1.8.0-openjdk-debuginfo --enablerepo=
debug*

相关文章

网友评论

      本文标题:JDK升级&jmap等命令没法使用解决

      本文链接:https://www.haomeiwen.com/subject/idmrdqtx.html