Running .pkg on MAC OS from java code

后端 未结 3 1659
青春惊慌失措
青春惊慌失措 2021-01-14 23:41

Am trying to run a .mpkg application from my java code :

public void runNewPkg(){

try {

           String command = \"sudo installer -pkg Snip.mpkg -target /App         


        
3条回答
  •  夕颜
    夕颜 (楼主)
    2021-01-14 23:50

    You can provide the password to sudo:

    echo "p@sw0rd" | sudo -S cal -y 2011
    

    The command above runs 'cal -y 2011' with root permissions.

提交回复
热议问题