Cath
04/23/2021, 11:00 AMvar byteArray = this::class.java.classLoader.getResource("abc.jpg").readBytes()
Jonathan Olsson
04/23/2021, 11:51 AMresources
, not res
?Cath
04/23/2021, 11:53 AMTimo Gruen
04/23/2021, 12:17 PMvar byteArray = this::class.java.classLoader.getResource("/abc.jpg").readBytes()
(Note the absolute path of the resource)res
directory should be named resources
, which is the convention for such directories. If you are using gradle, this is the one being picked up by gradle while building and running your code.Cath
04/23/2021, 12:18 PMTimo Gruen
04/23/2021, 12:20 PM/abc.jpg
)
2. Rename res
to resources
If its still not working, just ping me and we ll see if I can help you somehow.Cath
04/23/2021, 12:20 PMNick Howes
04/24/2021, 6:27 AMresources/com/example/app/abc.jpg