0

I have a java application in which i need to run the commands as we do on the terminal using the java code.How can i achieve this please suggest.

I Used this code when doing it on windows :-

Process p = Runtime.getRuntime().exec(command);
2
  • 3
    You can do the exact same thing on a Mac (with different commands, obviously). Commented Mar 10, 2011 at 13:15
  • 1
    java is platform independent, just command aren't :) Commented Mar 10, 2011 at 13:17

1 Answer 1

1

You use the following:

Process p = Runtime.getRuntime().exec(command);

All you need to do is change the commands to Mac OS X commands.

Sign up to request clarification or add additional context in comments.

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.