0

I have this API - which I managed to carryout some API steps solely from the CLI without using their GUI. Now I need to execute these CLI commands (i.e. for carrying out these API steps) in Java. When surfing, I couldn't find a helpful link for sample code on how to deal with this. May I know how to execute CLI commands using Java code (say in a Java class)

Appreciate any insight, suggestions or guidance. Many thanks in advance

Kris
14.5k7 gold badges58 silver badges65 bronze badges
asked Jun 5, 2010 at 19:07

2 Answers 2

5

You can execute commands like that:

Runtime.getRuntime().exec("<put command here>");
answered Jun 5, 2010 at 19:11
Sign up to request clarification or add additional context in comments.

Comments

2

You should take a look at ProcessBuilder - or, the older alternative, the several Runtime.getRuntime().exec(...) methods.

answered Jun 5, 2010 at 21:19

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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.