I have native executable on device at /data/local/tmp
and using java api to run the exe java.runtime.exec() method. However, I get permission denied error:13(stacktrace attached below.)
String runexec= "/data/local/tmp/test";
Process p = Runtime.getRuntime().exec(runexec);
Java.io.IOException: Cannot run program "/data/local/tmp/test": error=13, Permission denied
W/System.err: at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
W/System.err: at java.lang.Runtime.exec(Runtime.java:692)
W/System.err: at java.lang.Runtime.exec(Runtime.java:525)
W/System.err: at java.lang.Runtime.exec(Runtime.java:422)
W/System.err: at android.view.View.performClick(View.java:6891)
W/System.err: at android.widget.TextView.performClick(TextView.java:12651)
W/System.err: at android.view.View$PerformClick.run(View.java:26083)
W/System.err: at android.os.Handler.handleCallback(Handler.java:789)
W/System.err: at android.os.Handler.dispatchMessage(Handler.java:98)
W/System.err: at android.os.Looper.loop(Looper.java:164)
W/System.err: at android.app.ActivityThread.main(ActivityThread.java:6938)
W/System.err: at java.lang.reflect.Method.invoke(Native Method)
W/System.err: at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
W/System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)
W/System.err: Caused by: java.io.IOException: error=13, Permission denied
W/System.err: at java.lang.UNIXProcess.forkAndExec(Native Method)
W/System.err: at java.lang.UNIXProcess.<init>(UNIXProcess.java:133)
W/System.err: at java.lang.ProcessImpl.start(ProcessImpl.java:128)
W/System.err: at java.lang.ProcessBuilder.start(Pro
Edit: test
exe has a+x or say 777
permission and functions properly via adb shell however, fails when invoked with java.
test
, but do you have permissions on every other segment of your path? – MarsAtomicsu -c ...
– user755su
you used root? – MarsAtomic