From 0d9806b9ffacc083e9c36b657b69b9d97fde8f47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mihai=20Capot=C4=83?= Date: Wed, 17 Feb 2016 11:26:13 -0800 Subject: [PATCH] Check memory options in JAVA_TOOL_OPTIONS JAVA_TOOL_OPTIONS is used by the JVM [1] so it must also be checked for memory options that conflict with the ones set in get_mem_opts. [1] https://docs.oracle.com/javase/8/docs/technotes/guides/troubleshoot/envvars002.html --- src/universal/bin/sbt-launch-lib.bash | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/universal/bin/sbt-launch-lib.bash b/src/universal/bin/sbt-launch-lib.bash index 1210fa9f3..ad0dc1ef5 100755 --- a/src/universal/bin/sbt-launch-lib.bash +++ b/src/universal/bin/sbt-launch-lib.bash @@ -73,10 +73,12 @@ addDebugger () { } get_mem_opts () { - # if we detect any of these settings in ${JAVA_OPTS} we need to NOT output our settings. + # if we detect any of these settings in ${JAVA_OPTS} or ${JAVA_TOOL_OPTIONS} we need to NOT output our settings. # The reason is the Xms/Xmx, if they don't line up, cause errors. if [[ "${JAVA_OPTS}" == *-Xmx* ]] || [[ "${JAVA_OPTS}" == *-Xms* ]] || [[ "${JAVA_OPTS}" == *-XX:MaxPermSize* ]] || [[ "${JAVA_OPTS}" == *-XX:MaxMetaspaceSize* ]] || [[ "${JAVA_OPTS}" == *-XX:ReservedCodeCacheSize* ]]; then echo "" + elif [[ "${JAVA_TOOL_OPTIONS}" == *-Xmx* ]] || [[ "${JAVA_TOOL_OPTIONS}" == *-Xms* ]] || [[ "${JAVA_TOOL_OPTIONS}" == *-XX:MaxPermSize* ]] || [[ "${JAVA_TOOL_OPTIONS}" == *-XX:MaxMetaspaceSize* ]] || [[ "${JAVA_TOOL_OPTIONS}" == *-XX:ReservedCodeCacheSize* ]]; then + echo "" elif [[ "${SBT_OPTS}" == *-Xmx* ]] || [[ "${SBT_OPTS}" == *-Xms* ]] || [[ "${SBT_OPTS}" == *-XX:MaxPermSize* ]] || [[ "${SBT_OPTS}" == *-XX:MaxMetaspaceSize* ]] || [[ "${SBT_OPTS}" == *-XX:ReservedCodeCacheSize* ]]; then echo "" else