Execution of curl command in java
We are having a .sh file which executes curl command we need to do the same curl execution of .sh file in java. We are facing problem in replicating the same behavior of .sh execution in java.
Runtime.getRuntime().exec("/path/yourscript.sh");
If you are trying to port your shell script to Java, I recommend using an HTTP library made for Java instead of curl, like Apache Commons HTTP Client.
However, if you really want to execute your shell script inside a Java program, you can use Darin's suggestion to use Runtime.getRuntime().exec("/path/yourscript.sh")
精彩评论