If you have a commandline you want to execute from a
java program you could use the Runtime class's exec() method. There are many posts with examples of how to do this. For example:
Runtime.getRuntime().exec("Command.com /c dir T*.java > TestDOSCMD.txt");
If you need to see the results, use the Process class with the above:
Process proc = Runtime.getRuntime().exec("command.com /c CD E:");
BufferedReader br = new BufferedReader(
new InputStreamReader(proc.getInputStream()));