JDK_JAVAC_OPTIONS parsing changes between JDK 17 and 18
Dimitri John Ledkov
dimitri.ledkov at surgut.co.uk
Wed Aug 7 15:35:38 UTC 2024
Hi,
I've searched all forums, stackoverflow, release notes, documentation and
attempted to read openjdk source code. I am not sure if below
environment variables options are supposed to work, if they do anything,
and how they should be done. The behaviour change is in JDK 18, but in
practice I only care about how it should be done in JDK 11, 17, 21.
With java 17
$ docker run -ti \
--env
'JDK_JAVAC_OPTIONS="-J--add-exports=java.base/sun.security.internal.spec=ALL-UNNAMED"'
\
--entrypoint javac openjdk:17 --version
javac 17.0.2
$ docker run -ti \
--env 'JDK_JAVAC_OPTIONS="-J-Djavax.net.ssl.trustStoreType=PKCS12"' \
--entrypoint javac openjdk:17 --version
javac 17.0.2
And yet with java 18 (19, 20, 21, 22)
$ docker run -ti \
--env
'JDK_JAVAC_OPTIONS="-J--add-exports=java.base/sun.security.internal.spec=ALL-UNNAMED"'
\
--entrypoint javac openjdk:18 --version
jerror: invalid flag:
-J--add-exports=java.base/sun.security.internal.spec=ALL-UNNAMED
Usage: javac <options> <source files>
use --help for a list of possible options
$ docker run -ti \
--env 'JDK_JAVAC_OPTIONS="-J-Djavax.net.ssl.trustStoreType=PKCS12"' \
--entrypoint javac openjdk:18 --version
error: invalid flag: -J-Djavax.net.ssl.trustStoreType=PKCS12
Usage: javac <options> <source files>
use --help for a list of possible options
Can anybody point me at relevant documentation or source code changes?
Or otherwise explain how to pass these options correctly?
Should they even be set in JDK_JAVAC_OPTIONS?
Should one specify '--add-exports' without '-J' prefix?
How does one specify trustStoreType - or does '-J-D' flag doesn't actually
do anything in JDK_JAVAC_OPTIONS?
Ideally looking for environment variables to set in my Dockerfile, rather
than command line arguments.
--
Regards,
Dimitri.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/discuss/attachments/20240807/d99bc86d/attachment.htm>
More information about the discuss
mailing list