execute file from defined directory with Runtime.getRuntime().exec

前端 未结 3 1099
时光取名叫无心
时光取名叫无心 2020-12-29 05:31

I just want to execute my file from a specific folder. in my case /data/data/my-package/files/. So i tried :

 Process process2=Runtime.getRuntime().exec(\"cd         


        
3条回答
  •  被撕碎了的回忆
    2020-12-29 06:28

    A different solution will be,

    Execute a .bat file from the Java Code

    And do all the directory change, and stuff inside the bat file

    For instance, my execute.bat file looks like this,

    cd flutter_app
    flutter build apk
    cd ..
    

    And the Java code looks like this,

    Process process = Runtime.getRuntime().exec("execute.bat");
    

提交回复
热议问题