Executing shell commands from java

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ashokformac
    New Member
    • Mar 2007
    • 16

    #1

    Executing shell commands from java

    how to execute a shell command from java on a mac machine..


    thanks in advance
  • dmjpro
    Top Contributor
    • Jan 2007
    • 2476

    #2
    Runtime.getRunT ime().exe("comm and") does not work???

    Comment

    • horace1
      Recognized Expert Top Contributor
      • Nov 2006
      • 1510

      #3
      Originally posted by ashokformac
      how to execute a shell command from java on a mac machine..


      thanks in advance
      try
      Code:
        Runtime fileremoval = Runtime.getRuntime();
        String rem = "rm dir.class";
        Process removal = fileremoval.exec(rem);
        int exitVal = removal.waitFor();
        System.out.println("Process Exit Value : "+ exitVal);

      Comment

      Working...