Repository: groovy Updated Branches: refs/heads/master 412ec8e01 -> 72b1d607b
Fix NoClassDefFoundError when using Java9 further Project: http://git-wip-us.apache.org/repos/asf/groovy/repo Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/72b1d607 Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/72b1d607 Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/72b1d607 Branch: refs/heads/master Commit: 72b1d607b058b22f2f7dea7717f30e02e29b9dd6 Parents: 412ec8e Author: sunlan <sun...@apache.org> Authored: Fri Sep 22 16:22:34 2017 +0800 Committer: sunlan <sun...@apache.org> Committed: Fri Sep 22 16:22:45 2017 +0800 ---------------------------------------------------------------------- src/bin/startGroovy | 7 +++++-- src/bin/startGroovy.bat | 7 ++++++- 2 files changed, 11 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/groovy/blob/72b1d607/src/bin/startGroovy ---------------------------------------------------------------------- diff --git a/src/bin/startGroovy b/src/bin/startGroovy index d727595..30a6f06 100644 --- a/src/bin/startGroovy +++ b/src/bin/startGroovy @@ -220,8 +220,6 @@ if $darwin; then JAVA_OPTS="$JAVA_OPTS -Xdock:name=$GROOVY_APP_NAME -Xdock:icon=$GROOVY_HOME/lib/groovy.icns" fi -JAVA_OPTS="$JAVA_OPTS --add-modules ALL-SYSTEM" - # For Cygwin, switch paths to Windows format before running java if $cygwin ; then GROOVY_HOME=`cygpath --mixed "$GROOVY_HOME"` @@ -279,6 +277,11 @@ if $cygwin ; then fi startGroovy ( ) { + JAVA_VERSION=`"$JAVACMD" -version 2>&1 | awk -F '"' '/version/ {print $2}' | cut -d "_" -f1` + if [[ "$JAVA_VERSION" > "1.8.0" ]]; then + JAVA_OPTS="$JAVA_OPTS --add-modules ALL-SYSTEM" + fi + CLASS=$1 shift # Start the Profiler or the JVM http://git-wip-us.apache.org/repos/asf/groovy/blob/72b1d607/src/bin/startGroovy.bat ---------------------------------------------------------------------- diff --git a/src/bin/startGroovy.bat b/src/bin/startGroovy.bat index f21a763..afc6c95 100644 --- a/src/bin/startGroovy.bat +++ b/src/bin/startGroovy.bat @@ -266,7 +266,12 @@ if not "%TOOLS_JAR%" == "" set GROOVY_OPTS=%GROOVY_OPTS% -Dtools.jar="%TOOLS_JAR set GROOVY_OPTS=%GROOVY_OPTS% -Dgroovy.starter.conf="%STARTER_CONF%" set GROOVY_OPTS=%GROOVY_OPTS% -Dscript.name="%GROOVY_SCRIPT_NAME%" -set JAVA_OPTS=%JAVA_OPTS% --add-modules ALL-SYSTEM +for /f "tokens=3" %%g in ('java -version 2^>^&1 ^| findstr /i "version"') do ( + SET JAVA_VERSION=%%g +) +for /f "useback tokens=*" %%a in ('%JAVA_VERSION%') do set JAVA_VERSION=%%~a +set JAVA_VERSION=%JAVA_VERSION:~0,5% +if "%JAVA_VERSION%" gtr "1.8.0" set JAVA_OPTS=%JAVA_OPTS% --add-modules ALL-SYSTEM if exist "%USERPROFILE%/.groovy/postinit.bat" call "%USERPROFILE%/.groovy/postinit.bat"