Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Reg: ActionListener

 
adeeb alexander
Ranch Hand
Posts: 268
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How can i run a batch file from my gui. Means how can i open a batch file which contains some code, when i click on the button. how can i specify the location of the file in the program. Anybody please help.
Thanks and Regards
In Advance.
 
Maneesh Godbole
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check out Runtime#exec. You can add an action listener to your button and invoke it in the action performed.
You can consider using a JFileChooser to select the batch file. That will be elegant.

Please note a batch file will not work on non windows platforms.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!