I am working in android studio in Windows and have this error after installing the app on my device.
java io IOException:Cannot run program "java" error:13, permission denied
In my program, I am executing a java command as follows:
try {
Process su = Runtime.getRuntime().exec("java -jar <jar file> <more command code>");
DataOutputStream outputStream = new DataOutputStream(su.getOutputStream());
StringBuffer output = null;
BufferedReader reader=new BufferedReader(new
InputStreamReader(su.getInputStream()));
String line="";
while((line=reader.readLine())!=null){
output.append(line+"\n");
}
String response=output.toString();
AlertDialog.Builder dialog=new AlertDialog.Builder(this);
dialog.setMessage(response);
dialog.show();
outputStream.writeBytes("exit");
outputStream.flush();
}
catch (IOException e)
{
AlertDialog.Builder dialog=new AlertDialog.Builder(this);
dialog.setMessage(e+"");
dialog.show();
}
I want to execute this java -jar command. And this is failing
What permissions am I missing here?
Edited to add: The required command works well from cmd. I also placed my jar file in libs folder of my app in android studio.