MohamedSanaulla
MohamedSanaulla

Reputation: 6242

java.nio.file.NoSuchFileException while creating a modular jar on Linux using Java 9

I have been trying to create a modular JAR in Java 9 running on Linux. Every time I run the command:jar --create --file=mlib/[email protected] --module-version 1.0 -C mods/math.util . I get the following exception

java.nio.file.NoSuchFileException: /tmp/[email protected] -> mlib/[email protected]
        at sun.nio.fs.UnixException.translateToIOException(java.base@9-ea/UnixException.java:92)
        at sun.nio.fs.UnixException.rethrowAsIOException(java.base@9-ea/UnixException.java:111)
        at sun.nio.fs.UnixCopyFile.move(java.base@9-ea/UnixCopyFile.java:462)
        at sun.nio.fs.UnixFileSystemProvider.move(java.base@9-ea/UnixFileSystemProvider.java:263)
        at java.nio.file.Files.move(java.base@9-ea/Files.java:1398)
        at sun.tools.jar.Main.validateAndClose(jdk.jartool@9-ea/Main.java:526)
        at sun.tools.jar.Main.run(jdk.jartool@9-ea/Main.java:397)
        at sun.tools.jar.Main.main(jdk.jartool@9-ea/Main.java:1769)

But the same command worked fine on Java 9 running on Windows. And I was able to successfully create the JAR.

I have been trying as root user on Linux.

can someone help me with solving this issue?

Upvotes: 2

Views: 1869

Answers (1)

MohamedSanaulla
MohamedSanaulla

Reputation: 6242

I found that I did not create the mlib directory before running the JAR command and hence the exception.

Upvotes: 4

Related Questions