Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to run a batch script (.bat file) from eclipse

People also ask

How do I run a batch file in eclipse?

set ECLIPSE_HOME=C:\Program Files\eclipse set JAVA_HOME=C:\Program Files\Java\jdk1. 7.0_75 start "eclipse" "%ECLIPSE_HOME%\eclipse.exe" -vm "%JAVA_HOME%\bin\javaw.exe" -data . Two path variables need to be set to reflect your current environment. To start Eclipse, run the batch file eclipse.

How do you run .bat file?

To run a batch file, move to the directory containing the file and type the name of the batch file. For example, if the batch file is named "hope. bat," you'd type "hope" to execute the batch file.

How do I run a Java batch file?

Runtime; Process run = Runtime. getRuntime(). exec("cmd.exe", "/c", "Start", "path of the bat file"); This will work for you and is easy to use.


You can call your .bat file using the External Tools feature (in the Run menu).


Example:

enter image description here

enter image description here

enter image description here


Or, you could create an Ant build file, which can call external applications.

This will give you the advantage to call the .bat not only from Eclipse, but other IDE's, or from command line (on any machine).

http://ant.apache.org/manual/Tasks/exec.html


You can also run a batch file (or any other executable file) by opening it with the System Editor. Use Open With -> System Editor.


Associate with text Editor by right-click - Open With (As of 2017 there is no plugin with special editor )

To run install plugin like https://marketplace.eclipse.org/content/easyshell
You can easy run .sh with Git Bash as well

or https://github.com/culmat/eExplorer