cannot start jstatd due to permission error

后端 未结 11 1132
野的像风
野的像风 2020-12-12 10:59

I try to run jstatd jvm monitoring tool on linux machine

jboss@hostAddr:/usr/java/jdk1.6.0_18/bin> uname -a
Linux hostAddr 2.6.16.60-0.34-smp #1 SMP Fri J         


        
11条回答
  •  南笙
    南笙 (楼主)
    2020-12-12 11:18

    A one liner using process substitution (though bashism):

    jstatd -p 1099 -J-Djava.security.policy=<(echo 'grant codebase "file:${java.home}/../lib/tools.jar" {permission java.security.AllPermission;};')
    

    Wrapped:

    jstatd -p 1099 -J-Djava.security.policy=<(echo 'grant codebase "file:${java.home}/../lib/tools.jar" {permission java.security.AllPermission;};')

    As of jdk1.8.0_92, the java launcher option prefix -J is still required.

    Note:

    The original problem is more likely due to the tilde ~, in ~/jstatd.all.policy, isn't expanded hence not understood by java, meanwhile either absolute path or using ${HOME} instead should work.

提交回复
热议问题