Scala getClass.getResource() returning null

后端 未结 4 1623
孤城傲影
孤城傲影 2021-01-01 11:10

I have this code:

val url: URL = getClass.getResource(\"com/mysite/main/test.fxml\")

and it always returns null (or Unit

4条回答
  •  攒了一身酷
    2021-01-01 11:31

    Late answer but I just had this same problem. The root cause was an incorrect rootProject.name entry in my settings.gradle. Once I fixed that, cleaned, and rebuilt my resource were able to load using getClass().getResource(). Hopefully that helps somebody.

提交回复
热议问题