Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/cassandra/3.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
使用Java外部程序所需的权限_Java_Linux_Permissions_External - Fatal编程技术网

使用Java外部程序所需的权限

使用Java外部程序所需的权限,java,linux,permissions,external,Java,Linux,Permissions,External,我编写的Java应用程序依赖于小型C程序。我决定将该程序的可执行版本放在参考资料中,当用户启动我的应用程序时,该应用程序将创建该程序的临时版本,并在关闭时将其删除 下面是主java程序的构造函数: public RankingCreator(String title) { super(title); if (!tempJudgeCreated) { // static variable try { InputStream istream

我编写的Java应用程序依赖于小型C程序。我决定将该程序的可执行版本放在参考资料中,当用户启动我的应用程序时,该应用程序将创建该程序的临时版本,并在关闭时将其删除

下面是主java程序的构造函数:

public RankingCreator(String title) {
    super(title);

    if (!tempJudgeCreated) { // static variable
        try {
            InputStream istream = (InputStream) getClass().getResourceAsStream("/res/IOIJudge");
            byte[] tempJudgeBytes = new byte[SIZE_OF_JUDGE];
            istream.read(tempJudgeBytes);
            istream.close();
            FileOutputStream ostream = new FileOutputStream(JUDGE);
            ostream.write(tempJudgeBytes);
            ostream.flush();
            ostream.close();
            Runtime.getRuntime().exec("chmod 777 " + JUDGE); // this line creates confusion
            tempJudgeCreated = true;
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
当我在Eclipse中时,这工作得很好,但当我在runnable JAR中导出这段代码时,这段代码失败了,甚至没有进入GUI部分。当我删除Runtime.getRuntime时。。。它进入GUI,但我没有使用它的必要权限