-3

I have a selenium project. I want to run my bat file using java code in ubuntu(Can I run a batch file inside a jar?)

But after all search everyone is giving me cmd based code which will only run in windows, I need a code which can be run in mac/Linux terminal as well

Runtime.getRuntime().exec("cmd /c start build.bat");

Above is the command I have found for windows but what about mac/linux

1 Answers1

2

Batch files are DOS scripts, they don't run on Linux.

.bat file cannot be run on ubuntu, You can create .sh file instead of .bat to run on UNIX/Linux environment.

.bat file is a windows batch file it contains a sequence of windows/dos commands.

.sh file is a UNIX shell script it contains a series of UNIX commands.

Please click on link here to know more about how .sh file can be created.

Rupesh Shinde
  • 1,933
  • 12
  • 22