Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jstack/jmap alternative in java 1.8

Tags:

java

jvm

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)

like image 883
Andrei Avatar asked Nov 27 '25 11:11

Andrei


1 Answers

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$ 
like image 194
WillShackleford Avatar answered Nov 30 '25 01:11

WillShackleford