Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

java.nio.file.FileSystemNotFoundException: Provider "jar" not installed #4

Closed
drtomforce opened this issue Jul 5, 2023 · 2 comments

Comments

@drtomforce
Copy link

Hej och tack för ditt arbete!

Använder Android Studio. Har fastnat i problem med vad jag tror beror på getResource() i tryUriFrom().

final URI caResourceUri = ResourceUtils.tryUriFrom("certificate.pem")
Så här ser min URI ut: caResourceUri : jar:file:/data/app/com.example.bluetoothfunctions-_gxA3PsSi10D4dBRV0j7PQ==/base.apk!/certificate.pem

När jag använder Paths.get(caResourceUri) får jag felmeddelande där felet verkar börja här: Caused by: java.nio.file.FileSystemNotFoundException: Provider "jar" not installed at java.nio.file.Paths.get(Paths.java:147)

Förstår jag rätt kan problemet ha att göra med konklusionen nedan som gör att detta kan fungera i test men inte "at runtime eftersom "there's no resource file at runtime" : "To conclude - URL returned by ClassLoader.getResource cannot be converted to java.io.File as a resource cannot be expressed as java.io.File. "

https://msitko.pl/blog/2019/10/19/when-your-code-fails-after-being-packaged-as-jar.html

Det verkar föreslås att man använder getResourceAsStream istället men då faller många funktioner eftersom de kräver en Path. Eller har jag missförstått något?

@NicklasWallgren
Copy link
Collaborator

Du har helt korrekt, jag ser till att släppa en ny version under morgondagen.

@NicklasWallgren
Copy link
Collaborator

Fixed in latest version.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants