0

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.

1
  • 2
    So what is the exact problem you're having? What have you got so far? What is your actual question? Commented Dec 11, 2009 at 7:22

2 Answers 2

4
Runtime.getRuntime().exec("/path/yourscript.sh");
Sign up to request clarification or add additional context in comments.

Comments

2

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.