how to restart java application, remembering its command line arguments

后端 未结 5 372
一整个雨季
一整个雨季 2021-01-14 03:07

I have a java application. It can be started with couple of command line flags. I want to provide ability \"restart\" the application by user.

Currently we save the

5条回答
  •  孤城傲影
    2021-01-14 03:39

    invoke new using

    java -jar appname.jar arg1 arg2  
    

    close current one using

    System.exit(0);   
    

    Here you won't face problem of retaining arg

    Here is example to invoke commands from java app

提交回复
热议问题