Hi All,
I'm trying to invoke povray using Java's Runtime.exec, but it isn't working.
Runtime.exec prematurely exits with dumping "core" file.
I'm using 2.4.2-2 kernel( probably RedHat 6.2).
any suggestion??
thank you.
here is my code
package edu.sfu.ensc.rendering.nodeserver.execution.runner;
/**
* Title:
* Description:
* Copyright: Copyright (c) 2001
* Company:
* @author
* @version 1.0
*/
import java.io.*;
public abstract class RuntimeExecutor {
public static boolean exec(String strCommandLine) throws Exception{
boolean bSuccess=true;
Process jcProc=null;
byte[] jcErrBuf=new byte[512];
byte[] jcOutBuf=new byte[1024];
try {
System.out.println(strCommandLine);
jcProc=Runtime.getRuntime().exec(strCommandLine);
BufferedInputStream jcStdErr=new
BufferedInputStream(jcProc.getErrorStream());
BufferedInputStream jcStdOut=new
BufferedInputStream(jcProc.getInputStream());
BufferedOutputStream jcStdErrCapture=null;
BufferedOutputStream jcStdOutCapture=null;
int nRead=0;
nRead=jcStdErr.read(jcErrBuf);
if(nRead>-1) {
while( nRead!= -1) {
System.out.println("***********error "+new
String(jcErrBuf));
nRead = jcStdErr.read(jcErrBuf);
}
bSuccess=false;
}
nRead=jcStdOut.read(jcOutBuf);
if(nRead>-1) {
while( nRead!= -1) {
System.out.println("***********out "+new
String(jcErrBuf));
nRead = jcStdOut.read(jcOutBuf);
}
bSuccess=true;
}
jcProc.waitFor();
} catch(Exception e) {
throw e;
}
return bSuccess;
}
public static void main(String[] args) {
try {
RuntimeExecutor.exec("/povray/povray -d -v +ki1.0 +kff25 +sf21
+ef25 /RenderNode/io/dyu.p3333.POVRAY.2_.pov");
} catch (Exception e) {
e.printStackTrace();
}
}
}
Post a reply to this message
|