POV-Ray : Newsgroups : povray.unix : Invoking povray on Linux using Java's Runtime.exec : Re: Invoking povray on Linux using Java's Runtime.exec Server Time
6 Oct 2024 13:45:02 EDT (-0400)
  Re: Invoking povray on Linux using Java's Runtime.exec  
From: James Orr
Date: 27 Nov 2002 12:12:10
Message: <3de4fcea$1@news.povray.org>
I compiled PovRay on Solaris WITH OUT X support and I use Java
Runtime.getRuntime().exec() to invoke it with out any problems. My java code
also runs on Windows and has no problem except that you need to add the
/EXIT as one of the cmdline args (so it exits when it is done).

Process process = Runtime.getRuntime().exec(POVRAY + " " +
options.substring(4)); //remove the data keyword

I am writing (currently functional) a distributed renderer using  Java,
Povray and some C++ (to recombine the output) and I will be testing on some
Linux nodes (currently all the nodes are Sparc/Solaris) in the next 1-2
weeks. So I will let you know if my Java code holds up or fails.

-James


"david" <dav### [at] hotmailcom> wrote in message
news: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.