开发者

Execution of curl command in java

开发者 https://www.devze.com 2022-12-14 05:41 出处:网络
开发者_运维百科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 samebehavior of .sh execution in
开发者_运维百科

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")

0

精彩评论

暂无评论...
验证码 换一张
取 消