i have a batch file saved on my desktop and it serves the purpose of opening a calculator when executed. i want this batch file to function quite in the same way using java. i wrote the following command in netbeans
package runbatch;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
public class Runbatch {
public static void main(String[] args) {
try {
Runtime.getRuntime().exec("cmd /c hello.bat");
} catch (IOException ex) {
Logger.getLogger(Runbatch.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
although i get the build to be successful i am not getting the calculator opened up.