I'm trying to write a JavaFX app in Clojure. As a simple test, I wanted to try to just launch a Hello World. To extend Application
, I decided to try using proxy
instead of :gen-class
. I wanted to be able to create a bare-bones function that creates an Application
, instead of requiring me to write the boilerplate every time.
The simple example I came up with was:
(let [^Application app
(proxy [Application] []
(start [self stage] (println "Hello World")))]
(Application/launch ^Class (.getClass app)
(into-array String [])))
The problem is, this causes an UnsupportedOperationException
:
UnsupportedOperationException start chat.graphics_tests.javafx_wrapper.proxy$javafx.application.Application$ff19274a.start (:-1)
It seems like it can't find the start
method that I implemented. My first thought was that the arguments to start
were wrong. They seem correct though. The first argument it receives is "this
", then the primary stage. I tried different numbers of arguments though, and I still get the same error. According to the docs:
If a method fn is not provided for an interface method, an UnsupportedOperationException will be thrown should it be called.
Which further my this suspicion.
The errors quite vague. Does anyone see what the problem is?