Java 1.8中的jstack/jmap替代 [英] jstack/jmap alternative in java 1.8
问题描述
在1.8发行版中,已经从一些 Java发行版中删除了jstack和jmap(可能还有其他)(即Windows发行版中仍然有它们,但在Linux发行版中不存在). /p>
Oracle表示它们是实验性的,因此可以随时将其删除. 但是,我发现这些小工具过去对于调试非常有用.例如,我经常使用jstack来打印特定java进程中的线程列表,等等.
问题:您是否知道它们的任何替代方法,或者Oracle是否只是在没有提供任何替代的情况下将其删除了?
编辑1
显然,这是在服务器JRE"版本中发生的(像这样的解决方案
我不确定您从何处获得从Linux发行版中删除它们的信息.我安装的最新JDK_1.8.0_60仍然有它们.
如果它消失了,jconsole将获得堆栈跟踪以及更多信息.
我从Oracle网站获得了标准下载:
shackle@shackle-desktop:~/NetBeansProjects/CppApplication_2$ /usr/local/jdk1.8.0_60/bin/java -XshowSettings:properties -version
Property settings:
awt.toolkit = sun.awt.X11.XToolkit
file.encoding = UTF-8
file.encoding.pkg = sun.io
file.separator = /
java.awt.graphicsenv = sun.awt.X11GraphicsEnvironment
java.awt.printerjob = sun.print.PSPrinterJob
java.class.path = .
java.class.version = 52.0
java.endorsed.dirs = /usr/local/jdk1.8.0_60/jre/lib/endorsed
java.ext.dirs = /usr/local/jdk1.8.0_60/jre/lib/ext
/usr/java/packages/lib/ext
java.home = /usr/local/jdk1.8.0_60/jre
java.io.tmpdir = /tmp
java.library.path = /usr/local/jdk1.8.0_60/jre/lib/i386/server
/usr/local/jdk1.8.0_60/jre/lib/i386
/usr/local/jdk1.8.0_60/jre/../lib/i386
/home/shackle/rcslib//lib/
/usr/local/jdk1.8.0_25/jre/lib/i386/client/
.
/usr/local/lib
/local/lib/
/usr/java/packages/lib/i386
/lib
/usr/lib
java.runtime.name = Java(TM) SE Runtime Environment
java.runtime.version = 1.8.0_60-b27
java.specification.name = Java Platform API Specification
java.specification.vendor = Oracle Corporation
java.specification.version = 1.8
java.vendor = Oracle Corporation
java.vendor.url = http://java.oracle.com/
java.vendor.url.bug = http://bugreport.sun.com/bugreport/
java.version = 1.8.0_60
java.vm.info = mixed mode
java.vm.name = Java HotSpot(TM) Server VM
java.vm.specification.name = Java Virtual Machine Specification
java.vm.specification.vendor = Oracle Corporation
java.vm.specification.version = 1.8
java.vm.vendor = Oracle Corporation
java.vm.version = 25.60-b23
line.separator = \n
os.arch = i386
os.name = Linux
os.version = 3.2.0-32-generic
path.separator = :
sun.arch.data.model = 32
sun.boot.class.path = /usr/local/jdk1.8.0_60/jre/lib/resources.jar
/usr/local/jdk1.8.0_60/jre/lib/rt.jar
/usr/local/jdk1.8.0_60/jre/lib/sunrsasign.jar
/usr/local/jdk1.8.0_60/jre/lib/jsse.jar
/usr/local/jdk1.8.0_60/jre/lib/jce.jar
/usr/local/jdk1.8.0_60/jre/lib/charsets.jar
/usr/local/jdk1.8.0_60/jre/lib/jfr.jar
/usr/local/jdk1.8.0_60/jre/classes
sun.boot.library.path = /usr/local/jdk1.8.0_60/jre/lib/i386
sun.cpu.endian = little
sun.cpu.isalist =
sun.desktop = gnome
sun.io.unicode.encoding = UnicodeLittle
sun.java.launcher = SUN_STANDARD
sun.jnu.encoding = UTF-8
sun.management.compiler = HotSpot Tiered Compilers
sun.os.patch.level = unknown
user.country = US
user.dir = /home/shackle/NetBeansProjects/CppApplication_2
user.home = /home/shackle
user.language = en
user.name = shackle
user.timezone =
java version "1.8.0_60"
Java(TM) SE Runtime Environment (build 1.8.0_60-b27)
Java HotSpot(TM) Server VM (build 25.60-b23, mixed mode)
shackle@shackle-desktop:~/NetBeansProjects/CppApplication_2$
With the 1.8 release, jstack and jmap (and probably others) have been removed from some java distributions (i.e. the windows distribution still has them, but they are not present on linux distributions).
Oracle says they are experimental, and hence, they can be removed at any time. However, I've found these little tools extremely helpful in the past, for debugging. For example I often use jstack to print the list of threads within a particular java process, etc.
Question : Do you know of any alternatives to them, or did Oracle simply removed them without providing anything instead ?
Edit 1
Apparently, this happens in the "server JRE" version (like this one http://download.oracle.com/otn/java/jdk/8u51-b16/server-jre-8u51-linux-x64.tar.gz), but not in the JDK versions. This is different than java 1.7, where server JRE also included those files.
While the reasoning behind this now makes a lot more sense, I'm still wondering if there's alternative tools like jmap/jstack in server JRE (it seems a bit troublesome to install a jdk on a server, just to look at some thread info)
I am not sure where you are getting info that they are removed from linux distributions. The latest JDK_1.8.0_60 I installed still has them.
If it goes away, jconsole gets stack traces and alot more.
I got the standard download from Oracle's website:
shackle@shackle-desktop:~/NetBeansProjects/CppApplication_2$ /usr/local/jdk1.8.0_60/bin/java -XshowSettings:properties -version
Property settings:
awt.toolkit = sun.awt.X11.XToolkit
file.encoding = UTF-8
file.encoding.pkg = sun.io
file.separator = /
java.awt.graphicsenv = sun.awt.X11GraphicsEnvironment
java.awt.printerjob = sun.print.PSPrinterJob
java.class.path = .
java.class.version = 52.0
java.endorsed.dirs = /usr/local/jdk1.8.0_60/jre/lib/endorsed
java.ext.dirs = /usr/local/jdk1.8.0_60/jre/lib/ext
/usr/java/packages/lib/ext
java.home = /usr/local/jdk1.8.0_60/jre
java.io.tmpdir = /tmp
java.library.path = /usr/local/jdk1.8.0_60/jre/lib/i386/server
/usr/local/jdk1.8.0_60/jre/lib/i386
/usr/local/jdk1.8.0_60/jre/../lib/i386
/home/shackle/rcslib//lib/
/usr/local/jdk1.8.0_25/jre/lib/i386/client/
.
/usr/local/lib
/local/lib/
/usr/java/packages/lib/i386
/lib
/usr/lib
java.runtime.name = Java(TM) SE Runtime Environment
java.runtime.version = 1.8.0_60-b27
java.specification.name = Java Platform API Specification
java.specification.vendor = Oracle Corporation
java.specification.version = 1.8
java.vendor = Oracle Corporation
java.vendor.url = http://java.oracle.com/
java.vendor.url.bug = http://bugreport.sun.com/bugreport/
java.version = 1.8.0_60
java.vm.info = mixed mode
java.vm.name = Java HotSpot(TM) Server VM
java.vm.specification.name = Java Virtual Machine Specification
java.vm.specification.vendor = Oracle Corporation
java.vm.specification.version = 1.8
java.vm.vendor = Oracle Corporation
java.vm.version = 25.60-b23
line.separator = \n
os.arch = i386
os.name = Linux
os.version = 3.2.0-32-generic
path.separator = :
sun.arch.data.model = 32
sun.boot.class.path = /usr/local/jdk1.8.0_60/jre/lib/resources.jar
/usr/local/jdk1.8.0_60/jre/lib/rt.jar
/usr/local/jdk1.8.0_60/jre/lib/sunrsasign.jar
/usr/local/jdk1.8.0_60/jre/lib/jsse.jar
/usr/local/jdk1.8.0_60/jre/lib/jce.jar
/usr/local/jdk1.8.0_60/jre/lib/charsets.jar
/usr/local/jdk1.8.0_60/jre/lib/jfr.jar
/usr/local/jdk1.8.0_60/jre/classes
sun.boot.library.path = /usr/local/jdk1.8.0_60/jre/lib/i386
sun.cpu.endian = little
sun.cpu.isalist =
sun.desktop = gnome
sun.io.unicode.encoding = UnicodeLittle
sun.java.launcher = SUN_STANDARD
sun.jnu.encoding = UTF-8
sun.management.compiler = HotSpot Tiered Compilers
sun.os.patch.level = unknown
user.country = US
user.dir = /home/shackle/NetBeansProjects/CppApplication_2
user.home = /home/shackle
user.language = en
user.name = shackle
user.timezone =
java version "1.8.0_60"
Java(TM) SE Runtime Environment (build 1.8.0_60-b27)
Java HotSpot(TM) Server VM (build 25.60-b23, mixed mode)
shackle@shackle-desktop:~/NetBeansProjects/CppApplication_2$
这篇关于Java 1.8中的jstack/jmap替代的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!