Scala getClass.getResource() returning null

后端 未结 4 1629
孤城傲影
孤城傲影 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:37

    Possibly it's not being copied to the bin/ directory from the src/ directory? This happens on recompilation, but if you drop it into the src/ directory after the program is already compiled, the IDE won't know.

提交回复
热议问题