Skip to content

Instantly share code, notes, and snippets.

@vmsh0
Forked from nicerobot/jstatd.sh
Last active February 18, 2021 10:37
Show Gist options
  • Save vmsh0/0ad496a620ef6f005a1b7d38d023d09d to your computer and use it in GitHub Desktop.
Save vmsh0/0ad496a620ef6f005a1b7d38d023d09d to your computer and use it in GitHub Desktop.
Java 11: run jstatd w/o error 'access denied (java.util.PropertyPermission java.rmi.server.ignoreSubClasses write)'
#!/usr/bin/bash
# should also work with zsh
# (c) 2021 Riccardo Paolo Bestetti - bestov.io
# license: as long as you keep the above copyright notice and this license, you can do whatever you want with this
PORT='1099'
echo "Starting on port $PORT..."
jstatd -p $PORT -J-Djava.security.policy=<(echo 'grant codebase "jrt:/jdk.jstatd" { permission java.security.AllPermission; }; grant codebase "jrt:/jdk.internal.jvmstat" { permission java.security.AllPermission; };')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment