Is it possible to get the command used to launch the jvm in java?

前端 未结 5 982
长情又很酷
长情又很酷 2020-12-09 01:15

I would like to know if it is possible to get from code the command used to launch a java program.

E.g. if I launch a java program with:

 java -cp li         


        
5条回答
  •  误落风尘
    2020-12-09 01:54

    in a linux machine would be easier to run:

    ps -ef | grep java
    

    this command will list all java programs running with it's used parameters.

    Not sure about what can be used in a windows environment.

提交回复
热议问题