I need to write a Clojure script to create a simple app by using Vaadin.
In Java I cam use some thing like this.
"import com.vaadin.Application;"
But I don't know how to do it in Clojure.
I need to know how to import it and the place I should keep that .jar.
There is a build tool for clojure called leiningen.
For example:
(ns your-project-name.core
(:import (com.vaadin Application)
(com.vaadin.ui Button Form HorizontalLayout)
(com.vaadin.data.Property ValueChangeEvent)))
Also read this article on how to use java classes in clojure: http://java.ociweb.com/mark/clojure/article.html#JavaInterop
Note that clojure does not provide a way to import every class in a Java package without specifying each class explicitly: How do I import the entire package but exclude some in Clojure?
I use Vaadin with Clojure as well and I initially had alot of pain. In the end I made sure I wrote alot of example Vaadin applications using Java only. Once I was familiar with Vaadin I wrote alot of example Clojure applications. Once I was proficient in both then I attempted to use Vaadin with Clojure, and I haven't looked back since.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With