How do I get the commandline that started the process

后端 未结 8 1392
小鲜肉
小鲜肉 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:35

    Have a look at YAJSW (Yet Another Java Service Wrapper) - it has JNA-based implementations for various OSes (including win32 and linux) that do exactly this so it can grab the commandline for a running process and create a config that wraps it in a service. A bit more info here.

提交回复
热议问题