Calling Clojure APIs from Java is discussed in my first tutorial. This tutorial explores calling your own Clojure functions from Java. A common use case for this is when you write a JavaFX UI and want to have the controller code written in Clojure.
Our first example explains how to call a simple Clojure function that takes no arguments and returns no values. (Technically, all Clojure fuctions return values, but that doesn’t mean we care about all values Clojure functions return.)
(ns java-clj-interop.core) (defn hello-world "Yeah. You guessed it. This prints 'Hello World!'" [] (println "Hello World!"))
Continue reading “Calling Custom Clojure Functions from Java”