Closed y-kaku closed 5 years ago
Works fine for me in 2.8.0 (although I use Maven). Have you checked the files are actually packed in the jar? Note also that they will be mounted in the URL at /, not /public -- that path is simply the folder in resources
where Spark will look.
Also did you run init()
to ignite the spark?
Static files location must be configured before route mapping. If your application has no routes, init() must be called manually after location is set.
This has worked for a very long time and changes to this functionality has not been done in quite a while. Closing for now.
Spark cannot load static resources from jar files.
spark framework version
code
gradle run on the console screen
java -jar static-file-bug-1.0-SNAPSHOT-jar-with-dependencies.jar