Unable to run gpg command in JAVA

Harakiri harakiri_23 at yahoo.com
Tue Aug 19 11:52:31 CEST 2008




--- On Thu, 8/14/08, Steve Revilak <steve at srevilak.net> wrote:

> From: Steve Revilak <steve at srevilak.net>

> 
> Try providing the command as a String[], e.g.
> 
>    String cmd[] = {
>       "gpg",
>      "--homedir",
>      System.getProperty("user.dir") +
> File.separator + ".gnupg",
>      "-s",
>      "-u",
>      "The Certificate Key"
>    };
> 
>    runtime.exec(cmd);
> 
> 

All of that is still not the right way to do it, what people need to know about java is that Runtime.exec does not START a shell - i.e. its not a bash or anything you are used.

This is a very old article but still true:

http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html

there are better examples but google is your friend



      



More information about the Gnupg-users mailing list