Search code examples
javaexceptionmodular

Throw Exception when I compile module-info.java


I got the blow Exception when running with jar -cvf to create jar file from class.Does anyone expreience this similar problem when creating package file? Appreciate in advance.

java.nio.file.NoSuchFileException: /var/folders/ms/zplmyl_j3y528bm2hb5sg3f40000gn/T/zoo.tours.api.jar15685611641399685111.jar -> ./mods/zoo.tours.api.jar
        at java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:92)
        at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:106)
        at java.base/sun.nio.fs.UnixCopyFile.move(UnixCopyFile.java:476)
        at java.base/sun.nio.fs.UnixFileSystemProvider.move(UnixFileSystemProvider.java:266)
        at java.base/java.nio.file.Files.move(Files.java:1426)
        at jdk.jartool/sun.tools.jar.Main.validateAndClose(Main.java:438)
        at jdk.jartool/sun.tools.jar.Main.run(Main.java:321)
        at jdk.jartool/sun.tools.jar.Main.main(Main.java:1649)

Solution

  • The reason is I defined a path which is not created /mods, but I utilized this path to generate the jar package. To solve this problem, just remove the path and set the jar directly. Or try to create specific path firstly.