The Unix/Python launchers detect the Java major version and add required JDK compatibility options automatically. The Windows native launcher does not do this today; it only forwards options supplied through the JAVA_OPTS environment variable.
That means Jython native Windows launcher can be made to work in build/test automation by setting JAVA_OPTS, but users running jython.exe directly on newer JDKs need to know the required flags themselves. Jython should automatically detect the Java version and add the appropriate compatibility flags if they have not already been provided by the user.
JDK 8:
- no extra compatibility arguments
JDK 9 through JDK 24:
--add-opens=java.base/java.io=ALL-UNNAMED
JDK 25 and newer:
--add-opens=java.base/java.io=ALL-UNNAMED
--add-opens=java.base/sun.nio.ch=ALL-UNNAMED
--enable-native-access=ALL-UNNAMED
--sun-misc-unsafe-memory-access=allow
Acceptance criteria:
jython.exe detects the Java major version.
- It adds the same compatibility arguments as the script launchers.
- It does not duplicate an option already supplied through
JAVA_OPTS or launcher JVM args native for users.
The Unix/Python launchers detect the Java major version and add required JDK compatibility options automatically. The Windows native launcher does not do this today; it only forwards options supplied through the
JAVA_OPTSenvironment variable.That means Jython native Windows launcher can be made to work in build/test automation by setting
JAVA_OPTS, but users runningjython.exedirectly on newer JDKs need to know the required flags themselves. Jython should automatically detect the Java version and add the appropriate compatibility flags if they have not already been provided by the user.JDK 8:
JDK 9 through JDK 24:
--add-opens=java.base/java.io=ALL-UNNAMEDJDK 25 and newer:
--add-opens=java.base/java.io=ALL-UNNAMED--add-opens=java.base/sun.nio.ch=ALL-UNNAMED--enable-native-access=ALL-UNNAMED--sun-misc-unsafe-memory-access=allowAcceptance criteria:
jython.exedetects the Java major version.JAVA_OPTSor launcher JVM args native for users.