Search This Blog

Saturday, June 28, 2014

Running batch files from eclipse

Eclipse provides external tools to configure and run ant scripts, batch files and many and others using workbench.
Let me show you how to run batch files using this utility.

  • Goto Run -> External Tools -> External Tools Configuration(Alt+R, E, E)
  • Click on programs and enter program name(User defined name).
  • Select the batch file, you can select from your workspace or from file system. You can also provide the variable(List of variable available). 
  • Finally click on run. Eclipse opens a new console and run your batch file. 
  • Once you run this command, next time you need not open this external tool preferences. You can see the recently used programs in external tools icon in eclipse toolbar. 


Some of the tasks that you can do using this utility
  • Open selected file  in command prompt 
    • Open External tools Configuration window
    • Create new program
    • Enter Location as ${env_var:SystemRoot}/System32/cmd.exe
    • Arguments as cd ${resource_loc}
  • Open selected file in Windows Explorer
    • Open External tools Configuration window
    • Create new program
    • Enter Location as ${env_var:SystemRoot}/explorer.exe
    • Arguments as ${resource_loc},/select
  • Running jar file
    • Open External tools Configuration window
    • Create new program
    • Enter Location as C:\Program Files\Java\jdk1.7.0_21\bin\javaw.exe
    • Arguments as -jar C:\software\jshint\jslint4java-2.0.5-dist\jslint4java-2.0.5\jslint4java-2.0.5.jar ${resource_loc}
Done. 

No comments:

Post a Comment