Re: External Command Call part 2 of 2 - More Java Than WebObjects
Re: External Command Call part 2 of 2 - More Java Than WebObjects
- Subject: Re: External Command Call part 2 of 2 - More Java Than WebObjects
- From: "Jonathan Fleming" <email@hidden>
- Date: Tue, 08 Jul 2003 23:36:31 +0100
...CONTINUED FROM POST Re: External Command Call part 1 of 2 - More Java
Than WebObjects
Using this code which is closer to what was originally issued to me I get
the error below it (the code never executes and the browser icon-IE-just
keeps going round as if stalled or hung):
protected WOComponent convertToThumb() throws IOException
{
String stdout = "";
Runtime runtime = Runtime.getRuntime();
NSLog.out.appendln("===\r convertToThumb -- Runtime.getRuntime() =
" + Runtime.getRuntime());
String optionArgs = " -size 90x90 " +
"\\Apple\\web\\WebObjects\\JandMGeneralMaintenance.woa\\Contents\\WebServerResources\\fullSizeImages800pix\\Conservatory4ChairDinner.jpg"
+ " -resize 90x90 +profile \"*\" " +
"\\Apple\\web\\WebObjects\\JandMGeneralMaintenance.woa\\Contents\\WebServerResources\\fullSizeImages800pix\\Conservatory4ChairDinnerThumb.jpg";
NSLog.out.appendln("===\r convertToThumb -- optionArgs = " +
optionArgs);
String pathToScriptFolder =
System.getProperty("c:\\imagemagick-5.5.7-q8\\");
String scriptName = System.getProperty("convert");
String[] args = new String[]{"sh", pathToScriptFolder + scriptName +
optionArgs};
NSLog.out.appendln("===\r convertToThumb -- String[] args = " +
args);
try {
Process p = runtime.exec(args);
NSLog.out.appendln("===\r convertToThumb -- Process p = " +
p);
p.waitFor();
int exitValue = p.exitValue();
InputStream is = p.getInputStream();
NSLog.out.appendln("===\r convertToThumb -- p.getInputStream()
= " + p.getInputStream());
InputStreamReader isr = new InputStreamReader(is);
BufferedReader br = new BufferedReader(isr);
NSLog.out.appendln("===\r convertToThumb -- BufferedReader br
= " + br);
String line = br.readLine();
while (line != null) {
stdout = stdout + line;
line = br.readLine();
NSLog.out.appendln("===\r convertToThumb -- String line =
" + line);
}
// THIS PROCESS RETURNS SOME VALUES BY INTERNALLY DEFINED
PROTOCOLS
// so you have to customize this
//THIS PART OF THE CODE LEFT OUT FOR BRIEFITY
//I DON'T THINK THIS PART OF THE CODE IS NEEDED FOR WHAT I AM
DOING
//BUT WOULD LIKE CONFIRMATION
return null;
}
-----------------THE ERROR----------------
===
convertToThumb -- Runtime.getRuntime() = java.lang.Runtime@787c16
===
convertToThumb -- optionArgs = -size 90x90
\Apple\web\WebObjects\JandMGeneralMaintenance.woa\Contents\WebServerResources\fullSizeImages800pix\Conservatory4ChairDinner.jpg
-resize 90x90 +profile "*"
\Apple\web\WebObjects\JandMGeneralMaintenance.woa\Contents\WebServerResources\fullSizeImages800pix\Conservatory4ChairDinnerThumb.jpg
===
convertToThumb -- String[] args = [Ljava.lang.String;@1a9d1b
===
convertToThumb -- Process p = java.lang.Win32Process@40984b
I'm really lost with what I should be doing with this code. I've read as
much on the subject as possible and it seems to be a troublesome topic for
most deveopers who have to use this runtime.exec() method, so I'm seeking
complete help here.
Jonathan :^/
_________________________________________________________________
Sign-up for a FREE BT Broadband connection today!
http://www.msn.co.uk/specials/btbroadband
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.