How to encrypt files by using pgp?

I’m just a new guy to use webmethods.
i want to use PGP.exe to encrypt some files by java service.
But we tried so many times,just failed.
can webmethods invoke windows program?

Our code like this:

IDataCursor pipelineCursor = pipeline.getCursor();
String filepath = IDataUtil.getString( pipelineCursor, “filepath” );
String filename = IDataUtil.getString( pipelineCursor, “filename” );
String encode = IDataUtil.getString( pipelineCursor, “encode” );

Runtime rt = Runtime.getRuntime();
rt.exec("cmd.exe /k start pgp -e “+ filepath + filename +” "+encode);
}catch(Exception e){

// pipeline
IDataCursor pipelineflag = pipeline.getCursor();
IDataUtil.put( pipelineflag, “rtnflag”, errorMessage);

Instead of the following:

I recommend building the entire command string in Java first then passing only that as the parameter to rt.exec(). Much easier to see whether your command string is what you expect that way.