How do I get the commandline that started the process

后端 未结 8 1399
小鲜肉
小鲜肉 2020-11-30 10:25

From Java, is it possible to get the complete commandline with all arguments that started the application?

System.getEnv() and System.getPropertie

8条回答
  •  青春惊慌失措
    2020-11-30 10:33

    In Linux/UNIX that should be possible when you get the output of that command (run in a shell)

    cat /proc/$PPID/cmdline
    

    But that is not portable at all and should therefore not be used in Java...

提交回复
热议问题