how to use Runtime.getRuntime().exec()?

I have a cmd below:"D:\Program Files\MySQL\MySQL Server 5.0\bin\mysqld-nt" --defaults-file="D:\Program Files\MySQL\MySQL Server 5.0\my.ini" mysqlthe is serval strings and I don't new how to add it to Runtime.getRuntime().exec().Help me!Thanks a lot!
[285 byte] By [lookora] at [2007-10-2 6:04:36]
# 1

This handy article is the standard answer to this kind of query:

http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html

The author shows you how to run the command using Process.exec() and how to increase the robustness of your app by reading both STDOUT and STDERR.

Cheers,

John

john_greenhowa at 2007-7-16 13:05:05 > top of Java-index,Java Essentials,Java Programming...
# 2

Create an array of strings and put each string to an array element and pass it to exec.

By the way why do you want to start mysql from your java app directly. You can register it as a background service and then control the service. I think that will make things more simple.

all you will need is two commands.

net start mysql

net stop mysql

LRMKa at 2007-7-16 13:05:05 > top of Java-index,Java Essentials,Java Programming...