aspose file tools*
The moose likes Java in General and the fly likes runtime exec Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "runtime exec" Watch "runtime exec" New topic
Author

runtime exec

Peter Straw
Ranch Hand

Joined: Jan 08, 2002
Posts: 79
Is it possible to run a command line type instruction from within Java, even if the command line isn't a program like word.exe ( I am trying to run a mysqldump command to copy a database from one linux box to another ).
...Is it possible to call a shell script using runtime exec? or is there a better way
TIA
Steve Deadsea
Ranch Hand

Joined: Dec 03, 2001
Posts: 125
Shell scripts are interpretted by a program such as bash. You could call bash with an argument of the shell script.
Thomas Smets
Ranch Hand

Joined: Dec 11, 2001
Posts: 111
Peter it depends what you need to do !
For a pure dump, just do as said :
exec(new String(){"/bin/bash", "/home/me/myscript.sh"})
this will be the fastest.
Otherwise you may have a JDBC connection from DB to DB, also !


Thomas Smets
Just another developper
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: runtime exec