Execute Problem
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Heiko_Priebe
Posted On:   Wednesday, March 6, 2002 06:26 AM

Hi there, if i execute from a servlet netpbm (tool to convert jpg to gif) i receive an error. my ExecuteScript: execute = "ppmtogif /test/2.pnm > a.gif"; System.out.println(execute); long convertStart = System.currentTimeMillis(); Process p = Runtime.getRuntime().exec(execute); switch (COMMAND_MODE) { case 0: break; case 1: // Mode: WaitFor try { p.waitFor(); } catch (Exception ex) { System.err.println("JNetpbm.executeNetpbm(): " + ex); } break; case 2: // Mode: Catch Output BufferedReader procout = new BufferedReader( new InputStreamReade   More>>

Hi there,

if i execute from a servlet netpbm (tool to
convert jpg to gif) i receive an error.

			
my ExecuteScript:
execute = "ppmtogif /test/2.pnm > a.gif";
System.out.println(execute);
long convertStart = System.currentTimeMillis();
Process p = Runtime.getRuntime().exec(execute);
switch (COMMAND_MODE) {
case 0:
break;
case 1:
// Mode: WaitFor
try {
p.waitFor();
}
catch (Exception ex) {
System.err.println("JNetpbm.executeNetpbm(): " + ex);
}
break;
case 2:
// Mode: Catch Output
BufferedReader procout = new BufferedReader(
new InputStreamReader(p.getErrorStream())
);
String line;
while ((line = procout.readLine()) != null) {
System.out.println(" OUT > " + line);
}
break;
}



I receive the error:
			
ppmtogif: Program take zero or one argument (filename). You specified 3

And also if i want to execute with:
jpegtopnm sons_29.jpg | pnmscale -xysize 101 80 | ppmquant 16 | ppmtogif > 4.gif

i receive the error: too many arguments


if i try it by myself, i got no error. Only
with a Servlet.

Can somebody help me, please ?!!?!?
Thank you very much!

Heiko Priebe
prihei@web.de
http://www.feuerlocke.de

   <<Less

Re: Execute Problem

Posted By:   Tonio_Caputo  
Posted On:   Wednesday, March 6, 2002 06:55 AM

Please use tags to write your message
it is unreadable.

At first glance I must say that you
must not redirect stdout/stderr in
your command, you have to catch the
stdout in your java program, or if
the "converter" lets you,
use an option to inform the output file
without redirecting stdout.

hope this helps.

About | Sitemap | Contact