execute dos commands through java

Hi,

Im trying to execute dos commands through java like

try{

java.lang.Runtime.getRuntime().exec("cmd /c cls");

}catch(IOException e){

System.out.println(e.getMessage());

}

Not sure if its possible? however

open notepad would work

try{

java.lang.Runtime.getRuntime().exec("notepad");

}catch(IOException e){

System.out.println(e.getMessage());

}

Im trying to execute a cls commands to clear screen but without luck.

[913 byte] By [HolaJawna] at [2007-11-26 19:09:53]
# 1
The question is, which shell do you want to clear?I don't really know, but it could be that Runtime.exec executes its command in a new shell window...
ProggerFromKupfera at 2007-7-9 21:05:17 > top of Java-index,Java Essentials,Java Programming...
# 2
Im trying to run the dos commands in the current open window.Best RegardsJawn
HolaJawna at 2007-7-9 21:05:17 > top of Java-index,Java Essentials,Java Programming...
# 3
Jawn, you may find a JavaWorld.com article by Michael C. Daconta helpful: http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html?page=1Good luck!
Flatfingersa at 2007-7-9 21:05:17 > top of Java-index,Java Essentials,Java Programming...