How to give the java process a name in the operating system (other than java)

前端 未结 2 1441
庸人自扰
庸人自扰 2021-01-04 07:25

I\'m playing around with some microservices and running them on my laptop, simply assigning each micro-service a new port. The problem is that I\'d like to restart one of th

2条回答
  •  借酒劲吻你
    2021-01-04 08:11

    If you need to be able to differentiate between different java programs you can use the jps command that gives you a list of all java processes and running your program with

    java -Dname=myFirstService -cp  myFirstService.jar some.client.main.MyFirstService
    

    then if you do a:

    jps -v
    

    You will see your process correctly.

    If you need to change the process name at the OS level I recommend you use http://launch4j.sourceforge.net/

提交回复
热议问题