Repository: groovy
Updated Branches:
  refs/heads/GROOVY_2_6_X ef7173c2a -> ca05e9ff8


Fix NoClassDefFoundError when using Java9 further

(cherry picked from commit 72b1d60)


Project: http://git-wip-us.apache.org/repos/asf/groovy/repo
Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/ca05e9ff
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/ca05e9ff
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/ca05e9ff

Branch: refs/heads/GROOVY_2_6_X
Commit: ca05e9ff8f217d5ac16a87fff7023a481b9c1b3f
Parents: ef7173c
Author: sunlan <sun...@apache.org>
Authored: Fri Sep 22 16:22:34 2017 +0800
Committer: sunlan <sun...@apache.org>
Committed: Fri Sep 22 16:23:22 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/ca05e9ff/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/ca05e9ff/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"
 

Reply via email to