简体   繁体   中英

Java exec doesn't work in 64 bit Windows

I am trying to run the following ffmpeg command using java exec call. It works well in a 32bit computer but in 64 bit computer it doesn't work. Can someone please help me to solve this issue.

When I try the same command in command prompt as admin it works. Here the target is to create a video file in the tomcat. But when I try as a normal user in commandprompt it didn't work. Can this be an issue with tomcat privileges ?

If its works as admin, but not as normal user then it is likely a problem with the privileges.

I strongly recommend to add some logging around the execution.

for example

Runtime runtime = Runtime.getRuntime();
Process convertProcess = runtime.exec(execProperties);

/** important; read the error stream before! invoke waitFor */
BufferedReader errorReader = new BufferedReader(
    new InputStreamReader(convertProcess.getErrorStream()));
try {
    StringBuilder errorMessage = new StringBuilder();
    String line = null;
    while ((line = errorReader.readLine()) != null) {
         errorMessage.append(line);
         errorMessage.append("\n");
    }

    int returnValue = convertProcess.waitFor();
    if (returnValue != 0) {
         handleNonZeroReturnValue(returnValue)
    }
} finally {
   errorReader.close();
}

I hope that helps you to "debug" the problem

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM