2

I am trying to monitor VisualGC from my workstation.
Command: java -version

openjdk version "1.8.0_151"
OpenJDK Runtime Environment (build 1.8.0_151-b12)
OpenJDK 64-Bit Server VM (build 25.151-b12, mixed mode)

So i created a policy file and tried starting jstatd like below.

file name: jstatd.all.policy

grant codebase "file:${java.home}/../lib/tools.jar" {
   permission java.security.AllPermission;
};

Command tried: jstatd -J-Djava.security.policy=jstatd.all.policy

error: -bash: jstatd: command not found

command: rpm -qa | grep java
Output:

tzdata-java-2017c-1.el7.noarch
javapackages-tools-3.4.1-11.el7.noarch
java-1.8.0-openjdk-headless-1.8.0.151-5.b12.el7_4.x86_64
java-1.8.0-openjdk-1.8.0.151-5.b12.el7_4.x86_64
python-javapackages-3.4.1-11.el7.noarch

Also, on visualvm, Tab: Visual GC, I am seeing "Not supported for this JVM"

Pramod
  • 113
  • 2
  • 14
  • Are you sure you've installed JDK, not JRE? – apangin Jan 14 '18 at 01:08
  • Yes, I mentioned above the output from the command also. – Pramod Jan 14 '18 at 06:14
  • The above command does not tell whether you have [JDK or JRE](https://stackoverflow.com/questions/1906445/what-is-the-difference-between-jdk-and-jre). `jstatd` is a part of JDK. "jstatd: command not found" means that you don't have JDK installed or `PATH` environment variable is not configured properly. – apangin Jan 14 '18 at 12:50
  • command: java -version, shows open jdk 1.8 (which i mentioned in first line, which is not properly formatted) – Pramod Jan 15 '18 at 00:36
  • Again: `java -version` does not distringuish between JDK and JRE. The link above describes the difference. JRE is a part of OpenJDK but without tools like javac, jstatd etc. Can you show the list of openjdk packages installed on your system? – apangin Jan 15 '18 at 11:54
  • Updated the question with rpm output. – Pramod Jan 16 '18 at 03:27
  • 2
    That's right - you have Java Runtime Environment installed, but not Java Development Kit. Install `java-1.8.0-openjdk-devel` package which includes jstatd. – apangin Jan 16 '18 at 10:40

1 Answers1

9

Note that jstatd in CentOS 7 is now part of the package java-1.8.0-openjdk-devel.

To install it:

yum install java-1.8.0-openjdk-devel
Valerio Bozz
  • 1,176
  • 16
  • 32
patking
  • 91
  • 1
  • 2