You can use Runtime exec in java to execute dos commands from java code.
Based on Senthil's answer here:
Process p = Runtime.getRuntime().exec("cmd /C ver");
BufferedReader stdInput = new BufferedReader(new InputStreamReader(p.getInputStream()),8*1024);
BufferedReader stdError = new BufferedReader(new InputStreamReader(p.getErrorStream()));
// read the output from the command
String s = null;
System.out.println("Here is the standard output of the command:\n");
while ((s = stdInput.readLine()) != null)
System.out.println(s.replace("[","").replace("]",""));
Output = Microsoft Windows Version 6.1.7600