ADDITIONAL SYSTEM INFORMATION :
Microsoft Windows 10.0.22621
openjdk full version "22-ea+15-1134"
A DESCRIPTION OF THE PROBLEM :
The jar tool should gracefully handle the case where the --release argument is not specified last.
This is mainly an issue with operation modes like --describe-module and --validate
To demonstrate, in a JDK 22 directory, run the following 2 commands:
.\bin\jar.exe --describe-module --release 9 -f .\lib\jrt-fs.jar
.\bin\jar.exe --validate --release 9 -f .\lib\jrt-fs.jar
Expected:
Both commands are handled gracefully (either they work and allow --release to be specified anywhere, or they give a meaningful error message which points out that --release must be specified as the last argument).
Actual:
The first command gives the cryptic error "'-d, --describe-module' option requires no input file(s) to be specified".
The second command fails with a "java.nio.file.FileAlreadyExistsException"
            
Microsoft Windows 10.0.22621
openjdk full version "22-ea+15-1134"
A DESCRIPTION OF THE PROBLEM :
The jar tool should gracefully handle the case where the --release argument is not specified last.
This is mainly an issue with operation modes like --describe-module and --validate
To demonstrate, in a JDK 22 directory, run the following 2 commands:
.\bin\jar.exe --describe-module --release 9 -f .\lib\jrt-fs.jar
.\bin\jar.exe --validate --release 9 -f .\lib\jrt-fs.jar
Expected:
Both commands are handled gracefully (either they work and allow --release to be specified anywhere, or they give a meaningful error message which points out that --release must be specified as the last argument).
Actual:
The first command gives the cryptic error "'-d, --describe-module' option requires no input file(s) to be specified".
The second command fails with a "java.nio.file.FileAlreadyExistsException"
- relates to
- 
                    JDK-8167237 Jar tool can not correctly find/process the --release option if it occurs before the file list -           
- Resolved
 
-         
- 
                    JDK-8345506 jar --validate may lead to java.nio.file.FileAlreadyExistsException -           
- Resolved
 
-         
- links to
- 
                     Review(master)
        openjdk/jdk/22079 Review(master)
        openjdk/jdk/22079