Execute a command programmatically in Spring Boot app

Viewed 179

I want to execute this command in SpringBoot application:

keytool -import -keystore trustStore.jks -file certCA.der -storepass example << EOF
\ yes
\ EOF

My problem is that I'm not able to insert "yes" automatically in my code.

Runtime.getRuntime().exec("keytool -import -keystore trustStore.jks -file certCA.der -storepass example");

How can I do that?

1 Answers

Use -noprompt argument in your command

Related