Skip to content

Instantly share code, notes, and snippets.

@DomBlack
Created July 30, 2015 13:49
Show Gist options
  • Save DomBlack/51f02d843fd94704500d to your computer and use it in GitHub Desktop.
Save DomBlack/51f02d843fd94704500d to your computer and use it in GitHub Desktop.
SBT / Java Selection
function nextfreeport()
{
for port in $(seq $1 65000); do; (netstat -ant | grep ".$port ") > /dev/null; if [ $? -eq 1 ]; then; echo "$port" && break; fi; done
}
alias sbt7='JAVA_HOME=$(/usr/libexec/java_home -v 1.7.0) && sbt -jvm-debug $(nextfreeport 5005) -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=$(nextfreeport 9010) -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.local.only=true -Djava.rmi.server.hostname=127.0.0.1'
alias sbt8='JAVA_HOME=$(/usr/libexec/java_home -v 1.8.0) && sbt -jvm-debug $(nextfreeport 5005) -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=$(nextfreeport 9010) -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.local.only=true -Djava.rmi.server.hostname=127.0.0.1'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment