summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJaikiran Pai <jaikiran@apache.org>2021-11-28 18:41:17 +0530
committerJaikiran Pai <jaikiran@apache.org>2021-11-28 18:47:02 +0530
commit0b028a211ad5f816620f8a4107f7eef65a49785d (patch)
tree97eb8f805b9a5a5a79d5d1fae08823ff18ef9dad /src
parent53fcbca451401a59881112355865f613bfcf534c (diff)
downloadant-0b028a211ad5f816620f8a4107f7eef65a49785d.tar.gz
Pass -Djava.security.manager=allow from *nix launcher script for Java 18
Diffstat (limited to 'src')
-rw-r--r--src/script/ant6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/script/ant b/src/script/ant
index 81107b58f..4095a729d 100644
--- a/src/script/ant
+++ b/src/script/ant
@@ -368,6 +368,12 @@ else
ant_sys_opts="-Djikes.class.path=\"$JIKESPATH\""
fi
fi
+# Run "java -XshowSettings:properties" and check the output for "java.specification.version" value
+JAVA_SPEC_VERSION=`"$JAVACMD" -XshowSettings:properties 2>&1 | grep "java.specification.version = " | tr -d '[:space:]'`
+if [ "$JAVA_SPEC_VERSION" == "java.specification.version=18" ]; then
+ # set security manager property to allow calls to System.setSecurityManager() at runtime
+ ANT_OPTS="$ANT_OPTS -Djava.security.manager=allow"
+fi
ant_exec_command="exec \"\$JAVACMD\" $ANT_OPTS -classpath \"\$LOCALCLASSPATH\" -Dant.home=\"\$ANT_HOME\" -Dant.library.dir=\"\$ANT_LIB\" $ant_sys_opts org.apache.tools.ant.launch.Launcher $ANT_ARGS -cp \"\$CLASSPATH\""
if $ant_exec_debug; then
# using printf to avoid echo line continuation and escape interpretation confusion