Forum Stats

  • 3,837,476 Users
  • 2,262,262 Discussions
  • 7,900,297 Comments

Discussions

ProcessBuilder is not working in windows for run gpg command

3433345
3433345 Member Posts: 3
edited Jun 23, 2017 1:17AM in Java Programming

Hi All,

I am using jdk 1.8 and I wrote code to run gpg command in ProcessBuilder  like below

ProcessBuilder pb = new ProcessBuilder("cmd","/C","gpg --batch --yes --cipher-algo 3DES -r ED873D23 --trust-model always --output (folder_path) --encrypt Input_File_path");

Process p=pb.start();

p.waitFor();

It is not creating encrypted file in given folder_path through above code but, in command prompt if I execute above command which I have given in parameter its creating encrypted file in given folder_path properly.

And I used Runtime.getRuntime().exec(" cmd.exe /C gpg --batch --yes --cipher-algo 3DES -r ED873D23 --trust-model always --output (folder_path) --encrypt Input_File_path"); It is also not workig

Please suggest

Thanks in advance.

Answers

This discussion has been closed.