On Sep 16, 1:24 am, Joost <jo...@zeekat.nl> wrote:
> On Sep 16, 7:20 am, loonster <tbur...@acm.org> wrote:
>
> > Sound or image files will show up in the resulting uberjar if they
> > reside in a /resources subdirectory of a Leiningen home project
> > directory.  I can't find any documentation for how to refer to and
> > load such resource files within a project.clj and/or a source clj file
> > so that that the resources can be used by a standalone jar.   Many
> > thanks for any hints.   Tim
>
> You can refer to resources using
>
> (clojure.java.io/input-stream (clojure.java.io/resource "path/to/
> image"))
>
> See also ring.util.response/resource-response if you want to do this
> in a war/jar web app.
>
> Joost.

Well, thanks all.  The most succinct code turned out to be
(clojure.java.io/resource "fileName") and so my test fragment now
consists of:

(ns depExp
  (:gen-class))

(import '(java.applet Applet)
        '(java.io File)
        '(java.net URL))

(defn -main [& args]
  (.play (Applet/newAudioClip (clojure.java.io/resource
"looncall.au"))))

;;;BTW, the "looncall.au" is a small sound file;;;

...which works fine in the REPL and it also compiles but the resulting
standalone jar file throws an error: "main"
java.lang.NullPointerException.   Am using lein uberjar.   ???

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to