Java ProcessBuilder.start() or Runtime.exec() enables one to construct and execute a command string. I am using this feature to run gpg. This works for some of the basic gpg commands (–clearsign, --detach-sign, --verify). However, when I try to include --passphrase or --local-user, gpg complains of invalid option even if the same command works if executed directly on the command line.
What am I missing/doing wrong?
Environment:
Windows 7 Enterprise, 64-bit
Gpg4win 2.2.4 (which has gpg 2.0.27)
Java 1.8.0_40.