|
|
|
|
|
|
| |
| |
|
|
|
|
| |
| |
|
|
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
|
|
| |
| |
|
|
|
|
| |
| |
|
|
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)
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
|
|
| |
| |
|
|
From: Thorsten Froehlich
Subject: Re: Invoking povray on Linux using Java's Runtime.exec
Date: 24 Nov 2002 05:18:22
Message: <3de0a76e$1@news.povray.org>
|
|
|
| |
| |
|
|
In article <web.3de02837d5d7fad2fe4e4f170@news.povray.org> , "david"
<dav### [at] hotmailcom> wrote:
> Hi All, it's me again.
Please do not multi-post in our groups. I removed your post in p.programming
as your problem is Unix specific.
As far as you problem is concerned, did you perhaps forgot to specify "-d"
on the command-line for POV-Ray? Others seem to have had similar problems
with scripts and remote execution and the like (what rights does a program
started through Java have?) and reading through the messages of the last few
month in this group may yield useful hints.
Thorsten
____________________________________________________
Thorsten Froehlich
e-mail: mac### [at] povrayorg
I am a member of the POV-Ray Team.
Visit POV-Ray on the web: http://mac.povray.org
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Hi
Thanks for the help.
However, it is still not working.
Every executable involved belong to root user and I do use -d option.
I looked through many messages posted here, but didn't find anything
that directly relates me. Nevertheless, I tried whatever I could find
from the past indirectly related postings, and I still couldn't figure...
frustrated..
Thorsten Froehlich wrote:
>In article <web.3de02837d5d7fad2fe4e4f170[at]news.povray.org> , "david"
><dav### [at] hotmailcom> wrote:
>
>> Hi All, it's me again.
>
>Please do not multi-post in our groups. I removed your post in p.programming
>as your problem is Unix specific.
>
>As far as you problem is concerned, did you perhaps forgot to specify "-d"
>on the command-line for POV-Ray? Others seem to have had similar problems
>with scripts and remote execution and the like (what rights does a program
>started through Java have?) and reading through the messages of the last few
>month in this group may yield useful hints.
>
> Thorsten
>
>____________________________________________________
>Thorsten Froehlich
>e-mail: mac### [at] povrayorg
>
>I am a member of the POV-Ray Team.
>Visit POV-Ray on the web: http://mac.povray.org
>
Post a reply to this message
|
|
| |
| |
|
|
From: James Orr
Subject: Re: Invoking povray on Linux using Java's Runtime.exec
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
|
|
| |
| |
|
|
|
|
| |