Why execute commands in console failed?

Hello Sir:

I want to run some commnads in console from Java Application, but I can only run simple one such as notepad etc, I cannot execute java and other commands such as dir or path etc,

see code below,

can somebody here help what is wrong here?

publicclass RuntimeGetRuntime{

publicstaticvoid main(String args[]){

Runtime r = Runtime.getRuntime();

Process p =null;

String cmd1[] ={"notepad","src/aaa/ReadFile.java"};

String cmd2[] ={"java","-version"};

String cmd3[] ={"cmd /c java","bin.aaa.ReadFile"};

String cmd[] ={"path"};

try{

p = r.exec(cmd);

System.out.println("Test aaaaa");

}catch (Exception e){

System.out.println("error executing " + cmd[0]);

}

}

}

here only cmd1 ok, all others failed.

Why?

Thanks in advance

[1804 byte] By [nissannissana] at [2007-11-27 7:04:29]
# 1
probably because only the one is something within the path?maybe put the full path to java.exe?
bsampieria at 2007-7-12 18:55:46 > top of Java-index,Desktop,Core GUI APIs...
# 2
I tried, but failed, it terminated with no output,
nissannissana at 2007-7-12 18:55:46 > top of Java-index,Desktop,Core GUI APIs...