Skip to content

Commit a965461

Browse files
authored
Merge pull request #1159 from abelsromero/issue-1155-remove-open-access-warnings-from-cli-for-v2.5.x
(v2.5.x) Remove open access warnings from cli
2 parents b76d453 + 1ef6104 commit a965461

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

CHANGELOG.adoc

+1
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,7 @@ Improvements::
307307
* Upgrade to Asciidoctor 2.0.8
308308
* Upgrade to asciidoctor-pdf 1.5.0-alpha.17 (#809)
309309
* Add Rouge source highlighter to asciidoctor.jar (#806)
310+
* Add required `--add-opens` to cli launch script to remove Jdk warnings when running on Java8 (#1155) (@abelsromero)
310311

311312
Bug Fixes::
312313

asciidoctorj-distribution/src/main/resources/customUnixStartScript.txt

+5-1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ APP_BASE_NAME=`basename "\$0"`
2929

3030
# Add default JVM options here. You can also use JAVA_OPTS and ${optsEnvironmentVar} to pass JVM options to this script.
3131
DEFAULT_JVM_OPTS=${defaultJvmOpts}
32+
readonly java_version=\$(java -version 2>&1 | sed -n ';s/.* version "\\(.*\\)\\.\\(.*\\)\\..*".*/\\1\\.\\2/p;')
33+
if [ "\$java_version" != "1.8" ]; then
34+
DEFAULT_JVM_OPTS="--add-opens java.base/sun.nio.ch=ALL-UNNAMED --add-opens java.base/java.io=ALL-UNNAMED \$DEFAULT_JVM_OPTS"
35+
fi
3236

3337
# Use the maximum available, or set MAX_FD != -1 to use that value.
3438
MAX_FD="maximum"
@@ -164,4 +168,4 @@ APP_ARGS=\$(save "\$@")
164168
# Collect all arguments for the java command, following the shell quoting and substitution rules
165169
eval set -- \$DEFAULT_JVM_OPTS \$JAVA_OPTS \$${optsEnvironmentVar} <% if ( appNameSystemProperty ) { %>"\"-D${appNameSystemProperty}=\$APP_BASE_NAME\"" <% } %>-classpath "\"\$CLASSPATH\"" ${mainClassName} "\$APP_ARGS"
166170

167-
exec "\$JAVACMD" "\$@"
171+
exec "\$JAVACMD" "\$@"

0 commit comments

Comments
 (0)