My Java application is started by running a set of commands that are present in a batch file (.bat file). And I imported this into Eclipse workbench. How do I execute the batch file from Eclipse. Similar to the one in command line, I directly give "path:\myBatchfile.bat". Is there any way I can do directly from Eclipse.
Asked
Active
Viewed 7.2k times
4 Answers
74

Franck Dernoncourt
- 77,520
- 72
- 342
- 501

Csaba_H
- 8,215
- 1
- 41
- 42
-
Wow, I just tried this and it works perfectly! I had no idea I could do this. Thank you! The only problem is that Eclipse complains while creating the file and in order to edit the file you need to open it differently otherwise you get a "win32 app" error. – djangofan Mar 31 '12 at 16:31
-
10In `External Tool Configurations`, you can create a new configuration under `Program` and select the .bat file for the `Location` field and give the working directory(select your project from workspace). Very easy solution... Thanks! – Dilini Rajapaksha Oct 04 '12 at 11:20
-
Thank you for this! Eclipse was holding onto the target directory of my maven project. And when I ran my mvn clean install from the windows console, it wouldn't perform the clean because eclipse locked the directory. But if I run the bat from eclipse, it now works fine. +1 – AlexScript Oct 05 '16 at 16:45
12
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).

martin clayton
- 76,436
- 32
- 213
- 198

Mercer Traieste
- 4,670
- 3
- 24
- 24
2
You can also run a batch file (or any other executable file) by opening it with the System Editor. Use Open With -> System Editor
.

SpaceTrucker
- 13,377
- 6
- 60
- 99
1
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

Paul Verest
- 60,022
- 51
- 208
- 332