I have a problem deserializing a record from within a swing application.
I wrote the minimal amount of code required to highlight the problem i'm 
having below.
(if unfamiliar with seesaw, this is just creating a JButton which 
deserializes the
record in the file "/tmp/point" on-click)

(ns babel.records
  (:require (seesaw (core :refer (alert frame button listen))
                            (mig :refer (mig-panel)))))

(defrecord Point [x y])

(comment
  "Serialization and deserialization from a REPL works fine."
  
  (spit "/tmp/point" (binding [*print-dup* true] (pr-str (->Point 1 2))))
  "/tmp/point" => #babel.records.Point[1, 2]
  
  (read-string (slurp "/tmp/point"))
  => #babel.records.Point{:x 1, :y 2}
  )

(defn framework []
  (let [b (button :text "Deserialize")]
    (listen b :action (fn [e] (alert (read-string (slurp "/tmp/point")))))
    (frame :content (mig-panel :constraints ["" "" ""]
                                           :items [[b]])
              :size [323 :by 200]
              :visible? true)))

;; Clicking the button throws the following error:
;; Exception in thread "AWT-EventQueue-0" 
java.security.PrivilegedActionException: 
java.security.PrivilegedActionException: java.lang.ClassNotFoundException: 
babel.records.Point

It looks to me that the class/record can't be seen from the EDT, is there a 
solution here?

-- 
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