简体   繁体   中英

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM