As noticed in start-of-JDK-24 work, after JDK-8294977 the file
test/jdk/java/lang/instrument/MakeJAR2.sh
which is used to create jar files hard-codes a JDK value of "23" to pair with the --enable-preview javac option. Some kind of environmental query should be used to provide the value to --release instead.
This should be addressed before the JDK 24 start.
Programmatically, the value to be used as an argument for --release is the result of the expression
Runtime.version().feature())
The shell script in question could be rewritten as Java program.