How to run several commands with SSH.Net?

How can I run commands on a console from Java program?

  • I know how to read inputs from a console and to write output on the console. But I can't find a way to put some commands on a console and run the command. Is there some APIs or something that does those kind of things? Any advice would be appreciated.

  • Answer:

    Actually I've found a solution. Using Runtime class, I could solve the problem. http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/Runtime.html example: delete a file "aaa" class test {   public static void main(String []args) {    try {      Runtime.getRuntime().exec(”rm aaa”);      System.exit(0);    } catch(Exception e) {      System.exit(1);    }  } }

Takumi Kato at Quora Visit the source

Was this solution helpful to you?

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.