https://kotlinlang.org logo
Title
a

Ayfri

09/06/2021, 7:28 PM
Hi, in my
resources
folder I have a folder named
languages
with inside a
kotlin.json
file, but when I do
""::class.java.getResource("languages/kotlin.json")
I get
null
, why does it occurs ?
1
t

theapache64

09/06/2021, 7:31 PM
Can you try with
.java.*classLoader*.getResource
?
a

Ayfri

09/06/2021, 7:34 PM
I get
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException: Cannot invoke "java.lang.ClassLoader.getResource(String)" because the return value of "java.lang.Class.getClassLoader()" is null
	at MainKt$App$1.invoke(Main.kt:22)
e

ephemient

09/06/2021, 8:00 PM
instead of
""
try one of your own classes.
String
is from the bootstrap classloader
a

Ayfri

09/06/2021, 8:02 PM
oh it works, nice, thank you a lot !