Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/369.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android Studio中的Java io IOException错误:13_Java_Android Studio - Fatal编程技术网

Android Studio中的Java io IOException错误:13

Android Studio中的Java io IOException错误:13,java,android-studio,Java,Android Studio,我在Windows的android studio中工作,在设备上安装应用程序后出现此错误 java io IOException:Cannot run program "java" error:13, permission denied 在我的程序中,我正在执行一个java命令,如下所示: try { Process su = Runtime.getRuntime().exec("java -jar <jar file> <more command code

我在Windows的android studio中工作,在设备上安装应用程序后出现此错误

java io IOException:Cannot run program "java" error:13, permission denied
在我的程序中,我正在执行一个java命令,如下所示:

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();

    }
试试看{
processsu=Runtime.getRuntime().exec(“java-jar”);
DataOutputStream outputStream=新的DataOutputStream(su.getOutputStream());
StringBuffer输出=null;
BufferedReader读取器=新的BufferedReader(新的
InputStreamReader(su.getInputStream());
字符串行=”;
而((line=reader.readLine())!=null){
输出。追加(行+“\n”);
}
字符串响应=output.toString();
AlertDialog.Builder dialog=新建AlertDialog.Builder(此);
设置消息(响应);
dialog.show();
outputStream.writeBytes(“退出”);
outputStream.flush();
}
捕获(IOE异常)
{
AlertDialog.Builder dialog=新建AlertDialog.Builder(此);
对话框。设置消息(e+“”);
dialog.show();
}
我想执行这个java-jar命令。这是失败的

我在这里缺少什么权限

编辑以添加:
所需的命令在cmd中运行良好。我还将jar文件放在android studio应用程序的libs文件夹中。

Thank@NicolásAlarcónRapela的可能副本。这些链接对我帮助不大。我已经编辑了我的问题。需要执行“java-jar”命令。但是需要添加什么权限呢?我想这不是编码问题,更可能与对某个文件夹的权限有关。但我无法确定哪个文件夹需要什么权限?