Re: Return Program Results
Re: Return Program Results
- Subject: Re: Return Program Results
- From: email@hidden
- Date: Tue, 04 Nov 2003 12:14:04 CDT
- Priority: 3 (Normal)
[demime could not interpret encoding binary - treating as plain text]
Dealing with Runtime.exec() can be somewhat more confusing than you would
expect. Here is a little article I found very useful in explaining some
of the pitfalls of Runtime.exec and how to get around them:
http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html
And, I'm attaching... oh wait, I'm not attaching, the Apple list strips
out attachments. Okay, I'll try appending it to the email, but the Apple
list doens't allow long emails. Okay, I'll post it on wodev.
It's a utility class I wrote for doing almost exactly what Scott is
trying to do. Using Runtime.exec to call the ImageMagick utilities to do
various image stuff. You may be able to just use my code outright,
otherwise it should provide you lots of hints for how to do it.
http://wodev.spearway.com/cgi-bin/WebObjects/WODev.woa/1/wa/Main?wikiPage=CallImageMagickProcess
--Jonathan
On Tue, 4 Nov 2003 11:44:06 -0500 Scott Lopatin wrote:
> I am writing a program using ImageMagick and I had one quick question.
> The first step in my scaling process is to get the width and height of
> the image. I have successfully done this on the command line using the
> following command:
>
> /usr/local/bin/identify -format "%w"
> /Users/lopatins/Desktop/image.jpg
>
> The above command will return the width of the file. I am running
> commands successfully using:
>
> Process process = Runtime.getRuntime().exec(command);
>
> Where command equals the string to run.
>
> What I don't know is how to return the output from the command line to
> a String variable that I can use in my program. Do you know how to pull
> the output of the program back into WebObjects?
>
> Thanks very much in advance for any help you can provide.
>
> Thanks,
> Scott
> _______________________________________________
> 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.
_______________________________________________
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.