POV-Ray : Newsgroups : povray.programming : Re: Invoking povray on Linux using Java's Runtime.exec Server Time
23 Dec 2024 06:52:50 EST (-0500)
  Re: Invoking povray on Linux using Java's Runtime.exec (Message 1 to 1 of 1)  
From: david
Subject: Re: Invoking povray on Linux using Java's Runtime.exec
Date: 23 Nov 2002 20:20:08
Message: <web.3de028b5d5d7fad2fe4e4f170@news.povray.org>
Hi All, it's me again.

This is amazing!!

After many hours of frustration,
I even coded a C program that calls "system" method or "execl" method to
invoke
povray. This program is called by Java. It didn't work.
Again, I coded a bash script to invoke povray, but it didn't work either
when
Java called the bash script.
(I used Java's Runtime.exec method)
Below is the error message
/povray/bash_run: line 3: 30022 Segmentation fault      (core dumped) $1 $2


So, in summary

Java -> povray (FAIL)
Java -> C Program -> povray (FAIL)
Java -> Bash script -> povray (FAIL)

But the strange thing is that when I call the C program or Bash script
directly
on command prompt, it works. It only fails when I call them through Java.

The only thing that I can try is Java's JNI mechanism. But, I really don't
want to do this. I would rather use different rendering engine!!




david wrote:
>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.