Home arrow static arrow Java Programming [Archive] - Calling Executables?
Warning: Creating default object from empty value in /www/htdocs/w008deb8/wiki/components/com_staticxt/staticxt.php on line 51
Java Programming [Archive] - Calling Executables?
This topic has 3 replies on 1 page.

Posts:2
Registered: 6/17/04
Calling Executables?  
Jun 17, 2004 6:32 AM



 
What ( if applicable ) is the easiest way to initiate an existing executable on a windows machine. For example, I would like to make a simple application that utilizes mysqldump.exe for backing up existing databases. This cannot be done through the JDBC as mysqldump is an .exe that runs external to mysql. If invoked through the command line, mysqldump can also take command line arguments to reference which database to back up and the location to store the .sql file. If anyone can steer me in any direction (even as far as tutorials to digest) it would be appreciated.
 

Posts:2,909
Registered: 13.8.2003
Re: Calling Executables?  
Jun 17, 2004 6:36 AM (reply 1 of 3)



 
System.getRuntime().exec();
 

Posts:24,036
Registered: 2/3/03
Re: Calling Executables?  
Jun 17, 2004 7:12 AM (reply 2 of 3)



 
Also, read this: [url=http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html]Navigate yourself around pitfalls related to the Runtime.exec() method[/url]
 

Posts:2
Registered: 6/17/04
Re: Calling Executables?  
Jun 17, 2004 7:14 AM (reply 3 of 3)



 
That's fine for calling an executable but how do I pass arguments to the executable?
Here is the command line syntax for using mysqldumb
c:\mysql\bin\mysqldump -u root dbname > c:\<file location>

System.getRuntime.exec() won't compile, but Runtime.getRuntime does
Runtime.getRuntime().exec("C:\\MySQL\\bin
mysqldump -u root dbname > c:\<file location>");
does not do what I would like.
 
This topic has 3 replies on 1 page.