在java中利用Runtime的exec方法启动cmd进程,并且调用Process的getInputStream方法Runtime r = Runtime.getRuntime(); 
可以获取cmd中字符串信息。比如你启动一个cmd,就可以得到 
Microsoft Windows XP [版本 5.1.2600] 
(C) 版权所有 1985-2001 Microsoft Corp. 但是我写了一段代码怎么也获取不到mysql的信息。 
代码如下: 
import java.io.BufferedOutputStream; 
import java.io.BufferedReader; 
import java.io.IOException; 
import java.io.InputStream; 
import java.io.InputStreamReader; 
public class dd { 
public static void main(String[] args) throws IOException { 
String exe = "mysql -uroot -p15936232410"; 
Runtime r = Runtime.getRuntime(); 
Process p = r.exec(exe); 
String line = null; 
//BufferedOutputStream bo=(BufferedOutputStream)p.getOutputStream(); 
//String a="show databases;\n"; 
//byte[] b=a.getBytes(); 
//bo.write(b); 
//bo.flush(); 
InputStream is = p.getInputStream(); 
System.out.println(is); 
BufferedReader in = new BufferedReader(new InputStreamReader(is)); 
while ((line = in.readLine()) != null) { 
System.out.println("pk"); 
System.out.println(line); 

//System.out.println(line = in.readLine()); 
in.close(); 
is.close(); 


InputStream是个空值。 
我在开始运行中输入mysql -uroot -p15936232410就可以启动mysql。 
但是为什么这个输入流为什么是空值? 
它应该能得到下面的字符串: 
Welcome to the MySQL monitor. Commands end with ; or \g. 
Your MySQL connection id is 30 
Server version: 6.0.3-alpha-community MySQL Community Server ( Type 'help;' or '\h' for help. Type '\c' to clear the buffer. 为什么啊