POV-Ray : Newsgroups : povray.unix : Invoking povray on Linux using Java's Runtime.exec : Invoking povray on Linux using Java's Runtime.exec Server Time
6 Oct 2024 13:54:53 EDT (-0400)
  Invoking povray on Linux using Java's Runtime.exec  
From: david
Date: 23 Nov 2002 16:55:08
Message: <web.3ddff8cb18780cfafe4e4f170@news.povray.org>
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

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.