I build my scala project with https://github.com/sbt/sbt-assembly to get a fatjar.
The structure of the project looks as following(You can see the resources folder, that contains a file SapConfig.json):
Then, I tried to execute the fatjar as following:
java -jar SapEvents-assembly-0.1.0.jar
java.nio.file.FileSystemNotFoundException
at com.sun.nio.zipfs.ZipFileSystemProvider.getFileSystem(ZipFileSystemProvider.java:171)
at com.sun.nio.zipfs.ZipFileSystemProvider.getPath(ZipFileSystemProvider.java:157)
at java.nio.file.Paths.get(Paths.java:143)
at ch.micarna.SapEventServer$.stream(SapEventServer.scala:22)
at ch.micarna.SapEventServer$.stream(SapEventServer.scala:16)
at fs2.StreamApp.$anonfun$runStream$1(StreamApp.scala:66)
at cats.effect.internals.IORunLoop$.cats$effect$internals$IORunLoop$$loop(IORunLoop.scala:128)
at cats.effect.internals.IORunLoop$.start(IORunLoop.scala:35)
at cats.effect.IO.unsafeRunAsync(IO.scala:257)
at cats.effect.IO.$anonfun$runAsync$1(IO.scala:175)
at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12)
at cats.effect.internals.IORunLoop$.step(IORunLoop.scala:167)
at cats.effect.IO.unsafeRunTimed(IO.scala:304)
at cats.effect.IO.unsafeRunSync(IO.scala:239)
at fs2.StreamApp.main(StreamApp.scala:83)
at ch.micarna.SapEventServer.main(SapEventServer.scala)
As you can recognize, I assume that the resource file could not be found.
The code, that read the resource file looks as following:
Paths.get(getClass.getClassLoader.getResource("SapConfig.json")
Where should I put my resource file?