When I am running mvn clean install for my build on linux RHEL 6. I\'m getting the following error: java.lang.outOfMemoryError heap space.
You can run the mvn command, so its irrelevant wether you are using a .sh or .bat file. For future reference you should keep in mind though that .bat files are for Windows, not Linux. Anyway, in the same shell you are running your mvn command in, do this first:
export MAVEN_OPTS="-Xmx512M"
Then execute your mvn command. Bump the number up if you still run out of memory.