Java Tools Tutorials - Herong's Tutorial Notes - Version 5.32, by Dr. Herong Yang
Starting 'jstatd' with a Security Policy File
This section provides a tutorial on how to start the JVM remote monitoring server 'jstatd' with an internal RMI registry and a security policy file.
In this tutorial, we are going to try to start the JVM remote monitoring server, "jstatd".
1. Run the "jstatd" command in a command window:
C:\herong>\Progra~1\java\jdk1.8.0\bin\jstatd Could not create remote object access denied (java.util.PropertyPermission java.rmi.server.ignoreSubClasses write) java.security.AccessControlException: access denied (java.util.PropertyPermission java.rmi.server.ignoreSubClasses write) at java.security.AccessControlContext.checkPermission (AccessControlContext.java:323) at java.security.AccessController.checkPermission (AccessController.java:546) at java.lang.SecurityManager.checkPermission (SecurityManager.java:532) at java.lang.System.setProperty(System.java:727) at sun.tools.jstatd.Jstatd.main(Jstatd.java:122)
The "access denied" error is expected, because "jstatd" requires a security policy file specified with the "java.security.policy" system property, if there is no security manager running on my machine.
2. Create the security policy file, tools.policy, that grants permissions to run "jstatd" and other tools in the tools.jar:
grant codebase "file:${java.home}/../lib/tools.jar" { permission java.security.AllPermission; };
3. Run "jstatd" with the security policy file, tools.policy specified to the "java.security.policy" system property:
C:\herong>\Progra~1\java\jdk1.8.0\bin\jstatd -p 1234 -J-Djava.security.policy=tools.policy
"jstatd" is running correctly now. It created an internal RMI registry and waiting at port 1234 for RMI protocol connections from remote machines by JVM monitoring tools. See the next section on how to run "jps" and "jstat" tools from remote machines.
Last update: 2015.
Table of Contents
'javac' - The Java Program Compiler
'java' - The Java Program Launcher
'jconsole' - Java Monitoring and Management Console
►'jstat' - JVM Statistics Monitoring Tool
'jps' - JVM Process Status Tool
Listing JVM Processes on the Local Machine with "jps"
'jstatd' - JVM Remote Monitoring Server
►Starting 'jstatd' with a Security Policy File
Connecting to 'jps' to Remote 'jstatd'
'jstat' Command Options and Parameters
Garbage Collection Testing Program
'jstat -gcutil' - Garbage Collection Statistics
Accessing Remote JVM Processes with 'jstat'
jvisualvm (Java VisualVM) - JVM Visual Tool
'javap' - The Java Class File Disassembler
'keytool' - Public Key Certificate Tool