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*
网友评论