Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problem invoking Runtime.exec with ImageMagick



Did you check the error stream for info?

Beyond that, here are some general things to check:

* Where is gs installed?  Is it in the path?
* How are you launching your app?  If you have a .app or double-clickable jar, you won't get the same environment (and path) that you would get if launched it from terminal.app.  You many need to put the path to gs in ~/.MacOsX/environment.plist.
* From the javadoc for Process: "The created subprocess does not have its own terminal or console."  Perhaps gs doesn't like that.

Rob

Ralph Scheuer wrote:
Hello everybody, 

in my Java application, I use ImageMagick's "identify" command line tool to get various properties of image files. 

However, in order to get the properties of EPS files, ImageMagick's "identify" uses ghostscript (calls gs), which I have downloaded and installed separately. 

"identify" also works nicely and seemlessly with the command line on EPS files exactly the same way it would work with JPEGs etc. 

However, Java's Runtime.exec method seems to require an extra step for dealing with identify's call to gs. The following code snippet: 

                try {

   

                    Process process = Runtime.getRuntime().exec(invocationString);

   

                    process.getInputStream().read(myBytes);

   

                    results = new String (myBytes);

   

                    System.out.println("##### "+ results );

   

                } catch (Exception exception) {

   

                }

produces my desired result string as long as I work with non-EPS files. If I use EPS files and identify calls "gs", my result string is empty and I get nothing back. 

Is there anything I have to watch out for? 

Thanks in advance for any hints...

Ralph

_______________________________________________ Do not post admin requests to the list. They will be ignored. Java-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/java-dev/email@hidden This email sent to email@hidden


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/java-dev/email@hidden

This email sent to email@hidden

References: 
 >Problem invoking Runtime.exec with ImageMagick (From: Ralph Scheuer <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.