#!/bin/bash
total=$(free -m | awk 'NR==2{print $2}')
used=$(free -m | awk 'NR==2{print $3}')
available=$[total-used]
symbol=m
java -Xmx$available$symbol -jar server.jar