I want a java program to execute the following shell command:
apktool.jar d /path/to/my/app.apk
This command perfectly works when executing it directly on command line.
Java Code:
public static void main(String[] args) { String command = "apktool d /path/to/my/app.apk"; try { Runtime.getRuntime().exec(command); } catch (IOException e1) { e1.printStackTrace(); } } There is no error, no exception. Nothing happens and i have the impression that I already searched the entire internet for a solution. Does anybody know what I am doing wrong? A simple command like
mkdir /path/to/a/new/folder
works without problems.
I tried the same using ProcessBuilder:
try { Process process = new ProcessBuilder(command).start(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } This time i only get "Cannot run program "apktool d /path/to/my/app.apk, No such file or directory". I can't even run the mkdir command.