cmd - Open a .Bat Using Java Apllication -


i'm trying open cmd using java + applying code open .jar applications output shown in .bat file. can tell me how it?

this code got,it run excecute file cmd doesnt show.

btntest.addactionlistener(new actionlistener() {         public void actionperformed(actionevent arg0) {             string bat = "c:"+file.separatorchar+"users"+file.separatorchar+"gebruiker"+file.separatorchar+"appdata"+file.separatorchar+"local"+file.separatorchar+"temp"+file.separatorchar+"hext"+file.separatorchar+"run.bat";             runtime rt = runtime.getruntime();             try {                 rt.exec(bat);             } catch (ioexception e) {                 // todo auto-generated catch block                 e.printstacktrace();             }         }     }); 

edited: works me:

string bat = "c:\\app.bat";  //try use \\ path seperator  try {     runtime.getruntime().exec("cmd /c start " + bat); } catch (ioexception e) {     e.printstacktrace(); } 

Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -