This content has been marked as final. Show 4 replies
I tried without CN option, command executed successsfully. keystore certificates are not created under current/any directory.
Process p = Runtime.getRuntime().exec("keytool -genkeypair -alias alias1 -keypass root -keystore keystore1 -storepass root -validity 60");
Tried exec(String) too. Same issue.
EJP wrote:One can also set the working directory using one of the overloaded exec() methods but ProcessBuilder is my preferred approach since the API is more flexible.
Use ProcessBuilder instead of that, it gives you a chance to set the current directory.
Of course the OP should read and digest the whole of http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html .