Reputation: 10243
I'm trying to run a program from SBT using sbt runMain
command.
But I'm getting below error -
[error] java.nio.file.NoSuchFileException: /home/user/java/8.0.181-oracle/jre/lib/jfxrt.jar
[error] at sun.nio.fs.UnixException.translateToIOException(UnixException.java:86)
[error] at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102)
[error] at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107)
[error] at sun.nio.fs.UnixFileAttributeViews$Basic.readAttributes(UnixFileAttributeViews.java:55)
[error] at sun.nio.fs.UnixFileSystemProvider.readAttributes(UnixFileSystemProvider.java:144)
[error] at sun.nio.fs.LinuxFileSystemProvider.readAttributes(LinuxFileSystemProvider.java:99)
[error] at java.nio.file.Files.readAttributes(Files.java:1737)
[error] at java.nio.file.FileTreeWalker.getAttributes(FileTreeWalker.java:219)
[error] at java.nio.file.FileTreeWalker.visit(FileTreeWalker.java:276)
[error] at java.nio.file.FileTreeWalker.walk(FileTreeWalker.java:322)
[error] at java.nio.file.Files.walkFileTree(Files.java:2662)
[error] at java.nio.file.Files.walkFileTree(Files.java:2742)
[error] (Compile / runMain) java.nio.file.NoSuchFileException: /home/rajkumar/java/8.0.181-oracle/jre/lib/jfxrt.jar
[error] Total time: 12 s, completed Aug 23, 2018 10:21:44 PM
SBT version details
$ sbt about
[info] This is sbt 1.2.1
[info] The current project is ProjectRef(uri("file:/home/rajkumar/Coding/Java/ConcurrentProgrammingInScala/"), "concurrentprogramminginscala") 0.1
[info] The current project is built against Scala 2.12.6
The java version details -
$ java -version
java version "1.8.0_181"
Java(TM) SE Runtime Environment (build 1.8.0_181-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.181-b13, mixed mode)
Also I couldn't find jfxrt.jar
file anywhere within jdk folder.
$ find . -type f -name jfxrt.jar
This command return no results.
The fedora version is -
$ cat /etc/fedora-release
Fedora release 28 (Twenty Eight)
Why do I get this this error? How to resolve this error?
Upvotes: 0
Views: 1292
Reputation: 1519
I believe the problem lies with the directory structure of the Java JRE. Clearly, your jfxrt.jar
is not where your program thinks it is, and this is because in Java 8 this jar is in the java/<version>/jre/lib/ext/
directory as opposed to java/<version>/jre/lib/
which is where your program is looking for it as it seems from the stack trace. One sort of hacky way of fixing this would be to copy your jfxrt.jar
to the java/<version>/jre/lib/
directory so it would find the file properly.
There may exist a more stable/safe solution for this, but until I (or someone else) finds this way, I would do this. Leave a comment if you have a question and I'll do my best to answer it. Hope this helps!
EDIT: I was searching around SO, and it appears that this question should also maybe help with getting the path set correctly.
Upvotes: 1