Skip to content

Commit 567d5f2

Browse files
committed
Adjust run script for Java 17.
1 parent b9960d4 commit 567d5f2

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

xstream-jmh/src/application/bin/xstream-jmh.cmd

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,17 @@ set JAVA_BIN=%JAVA_EXE%
4444
for %%i in (lib\*.jar) do call :APP_CP_append %%i
4545
call :APP_CP_append "config"
4646

47+
@REM * Open modules for parsers using Java 17 or higher
48+
@REM *************
49+
for /F "tokens=2 usebackq" %%j in (`%JAVA_BIN% -cp "%APP_CP%" com.thoughtworks.xstream.core.JVM ^| find "java.specification.version"`) DO SET JAVA_VERSION=%%j
50+
if %JAVA_VERSION% GEQ 17 set JAVA_OPTS=%JAVA_OPTS% --add-opens java.xml/com.sun.org.apache.xerces.internal.parsers=ALL-UNNAMED
51+
if %JAVA_VERSION% GEQ 17 set JAVA_OPTS=%JAVA_OPTS% --add-opens java.xml/com.sun.org.apache.xerces.internal.util=ALL-UNNAMED
52+
if %JAVA_VERSION% GEQ 17 set JAVA_OPTS=%JAVA_OPTS% --add-opens java.xml/com.sun.xml.internal.stream=ALL-UNNAMED
53+
4754
@REM * Set options
4855
@REM *************
4956
set JAVA_OPTS=%JAVA_OPTS% -Xmx2048m -Xss4m
5057

51-
5258
@REM * Main class
5359
@REM ************
5460
set MAIN_CLASS=org.openjdk.jmh.Main

xstream-jmh/src/application/bin/xstream-jmh.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,15 @@ for i in lib/*.jar; do
4141
APP_CP=$APP_CP:$i
4242
done
4343

44+
# * Open modules for parsers using Java 17 or higher
45+
# *************
46+
JAVA_VERSION=`$JAVA_BIN -cp $APP_CP com.thoughtworks.xstream.core.JVM | grep "java.specification.version" | cut -d ' ' -f 2`
47+
if [[ $JAVA_VERSION -ge 17 ]]; then
48+
JAVA_OPTS="$JAVA_OPTS --add-opens java.xml/com.sun.org.apache.xerces.internal.parsers=ALL-UNNAMED"
49+
JAVA_OPTS="$JAVA_OPTS --add-opens java.xml/com.sun.org.apache.xerces.internal.util=ALL-UNNAMED"
50+
JAVA_OPTS="$JAVA_OPTS --add-opens java.xml/com.sun.xml.internal.stream=ALL-UNNAMED"
51+
fi
52+
4453
# * Set options
4554
# *************
4655
JAVA_OPTS="$JAVA_OPTS -Xmx2048m -Xss4m"

0 commit comments

Comments
 (0)