I would like to create multi-release jar (for Java 8 and Java 9) by jar command.
There are several Netbeans IDE projects: com.jdojo.mrjar.jdk8, com.jdojo.mrjar.jdk9.
Projects source code is here.
Using command line I go to a parent folder and run command.
When I try to do this:
jar --create --file mrjars/com.jdojo.mrjar.jar
-C com.jdojo.mrjar.jdk8/build/classes .
--release 9 -C com.jdojo.mrjar.jdk9/build/classes .
I get a message:
Warning: entry META-INF/versions/9/.netbeans_automatic_build contains a class that
is identical to an entry already in the jar
Warning: entry META-INF/versions/9/.netbeans_update_resources contains a class that
is identical to an entry already in the jar
java.nio.file.NoSuchFileException: java.base/sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:85)
at java.base/sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:103)
at java.base/sun.nio.fs.WindowsFileCopy.move(WindowsFileCopy.java:384)
at java.base/sun.nio.fs.WindowsFileSystemProvider.move(WindowsFileSystemProvider.java:288)
at java.base/java.nio.file.Files.move(Files.java:1413)
at jdk.jartool/sun.tools.jar.Main.validateAndClose(Main.java:460)
at jdk.jartool/sun.tools.jar.Main.run(Main.java:343)
at jdk.jartool/sun.tools.jar.Main.main(Main.java:1670)
I think this is due to the presence of the development environment service files. Is there any possibility of filtering them (select only the files of a certain file type for packing them by jar)?
The jar operations described in Java Platform, Standard Edition Tools Reference.