On Mon, 23 Mar 2009 16:16:18 -0700 (PDT)
jose john <[email protected]> wrote:

| Hi There,
| I am using the following code snippet to run a utility called convert to 
convert between different image types.
| 
| arg[0] = "convert";
| arg[1] = "IMG-001.ppm";
| arg[2] =  "IMG.jpg";
| 
| Runtime rt = Runtime.getRuntime();
| try {
| Process proc = rt.exec(arg);
| int exitVal = proc.waitFor();
| System.out.println(exitVal);
| 
| } catch (IOException ex) {
| ex.printStackTrace();
| } catch (InterruptedException ex) {
| ex.printStackTrace();
| }
| 
| It works perfectly when I run it in Netbeans. But when I move to
| command prompt and try to run this class from there its not working.
| Its giving the exit value as 4. When I tried executing the convert
| utility from command prompt its works fine. But from java its not
| working. Can any body help me with this to understand what is happening
| here?
| 
Assuming that the script is working fine and being called. I have one
thing to say.

   Environment is Everything!

and the command line often has a very different runtime environment than
a network daemon.

That is things like
   * What user is actually running the script and does it have permissions
     Many daemons like network services run as a special, more restrictive
     user such as  httpd, apatche, or something else, and not as the user
     who create, wrote, or owns the script.

     Find out what 'user' runs it and make sure they have the
     appropriate access.  Especially if extra protections are being
     used such as  SELinux  or  chroot environments.

   * The Current directory the script is running in may not be the same
     as the script or calling program!

   * Environment variable search paths, such as "PATH" (where to find a
     command like "convert")  or  LD_LIBRARY_PATH, for its libraries.

   * File and Directory permissions,  can the running process access the
     executable and files involved.


  Anthony Thyssen ( System Programmer )    <[email protected]>
 -----------------------------------------------------------------------------
   Data: "I hate this! It is revolting!"
   Guinan: "More?"
   Date with a smile:   "Please."          -- Star Trek, "Generations"
 -----------------------------------------------------------------------------
     Anthony's Home is his Castle     http://www.cit.gu.edu.au/~anthony/
_______________________________________________
Magick-users mailing list
[email protected]
http://studio.imagemagick.org/mailman/listinfo/magick-users

Reply via email to