Change java version test in karaf.bat to deal with Java 9 and 10
@@ -395,8 +395,10 @@ if "%KARAF_PROFILER%" == "" goto :RUN
if "%ROOT_INSTANCE_RUNNING%" == "false" SET IS_RUNNABLE=true
if "%CHECK_ROOT_INSTANCE_RUNNING%" == "false" SET IS_RUNNABLE=true
if "%IS_RUNNABLE%" == "true" (
- for /f tokens^=2-5^ delims^=.-_^" %%j in ('"%JAVA%" -fullversion 2^>^&1') do set "JAVA_VERSION=%%k%"
- if "%JAVA_VERSION%" GTR 8 (
+ for /f tokens^=2-5^ delims^=.-_^" %%j in ('"%JAVA%" -fullversion 2^>^&1') do set "JAVA_VERSION=%%j%"
+ rem If major version is greater than 1 (meaning Java 9 or 10), we don't use endorsed lib but module
+ rem If major version is 1 (meaning Java 1.6, 1.7, 1.8), we use endorsed lib
+ if "%JAVA_VERSION%" GTR 1 (
"%JAVA%" %JAVA_OPTS% %OPTS% ^
--add-exports=java.base/org.apache.karaf.specs.locator=java.xml,java.xml.ws,ALL-UNNAMED ^
--patch-module java.base=lib/endorsed/org.apache.karaf.specs.locator-@@project.version@@.jar ^
