2

私はこれをnetbeans 7.2のパッケージ化されたグラスフィッシュで実行されているWebサービスから実行しようとしています:

void correrMotor() throws InterruptedException {

    try {
//          Runtime rt = Runtime.getRuntime();
//          Process pr = rt.exec("C:\\Users\\Admin\\Documents\\UNIBE\\Inv Ops\\Mercalum\\correrMotor.bat");
        Process p = Runtime.getRuntime().exec("C:\\Users\\Admin\\Documents\\UNIBE\\Inv Ops\\Mercalum\\correrMotor.bat");
        BufferedReader in = new BufferedReader(  
                            new InputStreamReader(p.getInputStream()));  
        String line = null;  
        while ((line = in.readLine()) != null) {  
            System.out.println(line); 
    }} 
    catch (IOException ex) {
        Logger.getLogger(EjecutarMotor.class.getName()).log(Level.SEVERE, null, ex);
        ex.printStackTrace();
    }
}

しかし、.exe (私のcorrerMotor.batは実行可能ファイルを呼び出すために結び付けられています) が見つからないというエラーが表示されますが、Windows エクスプローラーを使用してバットを実行すると、問題なく実行されます。許可が原因であると思われます、誰でもこれについて私を助けることができますか?

4

0 に答える 0