i'm trying to write a program ,that have toexecute the same code in linux terminal:
openssl req -passout pass:abc -subj /C=US/ST=IL/L=Chicago/O=IBM Corporation/OU=IBM Software Group/CN=John Smith/[email protected] -new > johnsmith.cert.csr
In the terminal it works fine, but in Java it didn't. I try something like this, but without result.
String[] cmd = { "openssl", "req -passout pass:abc -subj", "/C=US/ST=IL/L=Chicago/O=IBM Corporation/OU=IBM Software Group/CN=John Smith/[email protected]", "-new > johnsmith.cert.csr" };
Runtime.getRuntime().exec(cmd);
Can you explain me, what i miss.Thanks in advance. Best wishes Andrey
Runtime.getRuntime().exec("openssl req -passout pass:abc -subj /C=US/ST=IL/L=Chicago/O=IBM Corporation/OU=IBM Software Group/CN=John Smith/[email protected] -new > johnsmith.cert.csr");?execand build theProcessusing aProcessBuilder. Also break aString argintoString[] argsto account for arguments which themselves contain spaces.