Opening a terminal in mac and then executing a command on it


Results 1 to 4 of 4

Thread: Opening a terminal in mac and then executing a command on it

  1. #1
    Join Date
    May 2007
    Posts
    2

    Opening a terminal in mac and then executing a command on it

    Hi Guyz,
    What i am trying to do here is through a jsp page - open a terminal and then run a mysqldump on that terminal, all from the jsp page. Well i got a lot of documentation of doing the same in Windows using the cmd.exe but couldnt find one for doing the same for a mac.

    this is my code so far :-
    Runtime rt = Runtime.getRuntime();
    Process p = rt.exec("Open /Applications/Utilities/Terminal.app");

  2. #2
    Join Date
    Sep 2003
    Location
    Rochester, MN
    Posts
    3,604
    You want to open a terminal from a jsp page? I don't think it's going to let you do that, and if it does it probably shouldn't. Unless I'm missing something it sounds you could just run mysqldump directly through exec().

  3. #3
    Join Date
    May 2007
    Posts
    2
    Hi cybertron,
    You are right and that is exactly what i wanted to do ultimately, execute the mysql dump. but the command doesnt do it for some reason. For eg
    Runtime rt = Runtime.getRuntime();
    Process p = rt.exec("mysqldump -h000.000.000.000 -uabc -pxyz database client > ~/desktop/cli.txt

  4. #4
    Join Date
    Jun 2002
    Location
    Jamaica Plain, MA
    Posts
    458
    Quote Originally Posted by nisargz
    Hi cybertron,
    You are right and that is exactly what i wanted to do ultimately, execute the mysql dump. but the command doesnt do it for some reason. For eg
    Runtime rt = Runtime.getRuntime();
    Process p = rt.exec("mysqldump -h000.000.000.000 -uabc -pxyz database client > ~/desktop/cli.txt

    Not sure if you typed the command exactly, but your missing a ');' at the end.
    That might help with execution.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •