GnuPG class throwing null pointer exception

Hans-Christoph Steiner hans at
Wed May 28 05:01:48 CEST 2014

You might consider using gnupg-for java, we've put a lot of work into it
recently since it is the basis for GnuPG for Android:


On 05/27/2014 05:26 AM, winifred quartey-papafio wrote:
> Hello
> I'm having a problem encrypting a String text using the GnuPG class. I'm using the encrypt and decrypt class from which is based on the GnuPG class from However I keep getting a null pointer exception. I don't know what I'm doing wrong. I'd appreciate your help with this
> this is my code:
> GnuPG pgp = new GnuPG (); result = pgp.encrypt (text, keyID);and this is what throws the null pointer exception in the GnuPG class:public void encrypt(String str, String rcpt) { System.out.print("Encrypting... "); try {
> p= Runtime.getRuntime().exec(("gpg --armor --batch --encrypt -r "+ rcpt).split("\\s+")); } catch (IOException io) { System.out.println("Error creating process."); } ProcessStreamReader psr_stdout = new ProcessStreamReader("STDIN", p.getInputStream()); ProcessStreamReader psr_stderr = new ProcessStreamReader("STDERR", p.getErrorStream()); 
> ....
> }
> _______________________________________________
> Gnupg-users mailing list
> Gnupg-users at

PGP fingerprint: 5E61 C878 0F86 295C E17D  8677 9F0F E587 374B BE81

More information about the Gnupg-users mailing list