• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to run a Batch file???

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All!
I am trying to run a batch file �Mine.bat� from Java file �Helpme.java� I have written in batch file
D:\
cd javadoc
javac Myprog.java
java Myprog
But when I try to run it (�Mine.bat�) from �Helpme.java� by using,

String str[]={�Mine.bat�};
Process proc;
try{
proc=Runtime.getRuntime().exec("str");
}catch(Exception e){
System.out.println("Exception is raised");
}
The out put results in only the change of Path that is from c:\ it goes to D:\ and program stops instead of running whole Mine.bat, plz tell me what to do? My goal is to compile another java file that is �Myprog.java� from �Helpme.java�.
Files contain in the following directories.
C:\Mine.bat
C:\ Helpme.java
D:\javadoc\Myprog.java
I am using Windows me
I will wait for reply.
bye
 
tumbleweed
Posts: 5089
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Shahbaz I see you have also posted this thread this in the Java in General (intermediate) forum.
I'm closing this thread as it does not belong here. Good luck
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic