clojure.java.io/resource returns 无

clojure.java.io/resource returns nil

我需要在 Clojure 中加载基于 fxml 的 JavaFX 场景, 但是当我尝试加载资源时 "view.fxml" 它 returns nil.

这是我现在的代码:

(ns ui.ui_controller
(:import (javafx.application Application)
       (javafx.fxml FXMLLoader)
       (javafx.scene Scene)
       (javafx.stage Stage)))

(gen-class
:name ui.ui_controller
:extends javafx.application.Application)

(defn -main [& args]
(Application/launch ui.ui_controller args))

(defn -start [this stage]

 (let [loc (clojure.java.io/resource "view.fxml") 
    root (FXMLLoader/load loc)]

(.setScene stage (Scene. root))
(.setTitle stage "JavaFXML with Clojure Example")
(.show stage)))

并且在资源文件夹中是 view.fxml 文件,应该加载它。

在调用时 (println (clojure.java.io/resource "view.fxml")) 它 returns nil...

知道这里出了什么问题吗?

谢谢!

这是一个例子

(ns tst.clj.core
  (:use clj.core
        clojure.test )
  (:require
    [clojure.java.io :as io]
  ))

(def words (slurp (io/file (io/resource "count.txt"))))
(println words)


> ls -ldF resources/count.txt 
-rw-rw-r-- 1 alan alan 14 Jan  3 09:01 resources/count.txt

> cat resources/count.txt
one
two
three

> lein test

one
two
three