GitHub user am4dr opened a pull request: https://github.com/apache/groovy/pull/784
support JAVA_HOME including spaces Since Groovy 2.5.2, JAXB modules are added automatically based on detected Java version. But in my environment, NoClassDefFoundError for JAXB is still thrown. ```console $ where java C:\Program Files\Java\jdk-10.0.2\bin\java.exe $ groovy --version Groovy Version: 2.5.2 JVM: 10.0.2 Vendor: "Oracle Corporation" OS: Windows 10 $ type hello.groovy println "hello, Groovy 2.5.2" $ groovy hello.groovy Caught: java.lang.NoClassDefFoundError: Unable to load class org.apache.groovy.jaxb.extensions.JaxbExtensions due to missing dependency javax/xml/bind/JAXBContext java.lang.NoClassDefFoundError: Unable to load class org.apache.groovy.jaxb.extensions.JaxbExtensions due to missing dependency javax/xml/bind/JAXBContext at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ``` Java version detection in startGroovy.bat seems not to be able to handle JAVA_HOME containing spaces. ref: version detection in startGroovy.bat https://github.com/apache/groovy/blob/223366702a13ef369f216af2ba443670f42f02a1/src/bin/startGroovy.bat#L269-L272 Before this change, `JAVA_VERSION` is empty. ```console # enable DEBUG to show echos $ set DEBUG=1 $ groovy -v ... > for /F "tokens=3" %g in ('C:\Program Files\Java\jdk-10.0.2\bin\java.exe -version 2>&1 | findstr /i "version"') do (SET JAVA_VERSION=%g ) > for /F "useback tokens=*" %a in ('') do set JAVA_VERSION=%~a ... ``` After, `JAVA_VERSION` set correctly. ```console $ groovy -v ... > for /F "tokens=3" %g in ('call "C:\Program Files\Java\jdk-10.0.2\bin\java.exe" -version 2>&1 | findstr /i "version"') do (SET JAVA_VERSION=%g ) > (SET JAVA_VERSION="10.0.2" ) > for /F "useback tokens=*" %a in ('"10.0.2"') do set JAVA_VERSION=%~a ... ``` You can merge this pull request into a Git repository by running: $ git pull https://github.com/am4dr/groovy support-java_home-including-spaces Alternatively you can review and apply these changes as the patch at: https://github.com/apache/groovy/pull/784.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #784 ---- commit a3825e3b11a88059dc2d44cae0611f8da7f1054e Author: amadarain <t.f.octo@...> Date: 2018-08-14T08:16:16Z support JAVA_HOME including spaces ---- ---