I currently use a .bat
file that is utilized to invoke a java file. If I wanted to utilize the same functionality on Mac OS what format changes would I make? (unless the .bat
equivalent on Mac OS is the .sh
format?)
java -cp ".;.\supportlibraries\Framework_Core.jar;.\supportlibraries\Framework_DataTable.jar;.\supportlibraries\Framework_Reporting.jar;.\supportlibraries\Framework_Utilities.jar;.\supportlibraries\poi-3.8-20120326.jar;D:\downloads\Selenium 2.0\selenium-server-standalone-2.19.0.jar" allocator.testTrack
Any assistance would be appreciated.
bat files as they are only for a Windows PC, of no use on a Mac to other Unix computer.
The best alternative is PuTTY, which is both free and Open Source. Other great apps like Make Batch Files are cmder, PowerShell, KiTTY and Windows Command Prompt.
May be you can find answer here? Equivalent of double-clickable .sh and .bat on Mac?
Usually you can create bash script for Mac OS, where you put similar commands as in batch file. For your case create bash file and put same command, but change back-slashes with regular ones.
Your file will look something like:
#! /bin/bash java -cp ".;./supportlibraries/Framework_Core.jar;./supportlibraries/Framework_DataTable.jar;./supportlibraries/Framework_Reporting.jar;./supportlibraries/Framework_Utilities.jar;./supportlibraries/poi-3.8-20120326.jar;PATH_TO_YOUR_SELENIUM_SERVER_FOLDER/selenium-server-standalone-2.19.0.jar" allocator.testTrack
Change folders in path above to relevant one.
Then make this script executable: open terminal and navigate to folder with your script. Then change read-write-execute rights for this file running command:
chmod 755 scriptname.sh
Then you can run it like any other regular script: ./scriptname.sh
or you can run it passing file to bash:
bash scriptname.sh
The common convention would be to put it in a .sh file that looks like this -
#!/bin/bash java -cp ".;./supportlibraries/Framework_Core.jar;... etc
Note that '\' become '/'.
You could execute as
sh myfile.sh
or set the x bit on the file
chmod +x myfile.sh
and then just call
myfile.sh
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With