简体   繁体   中英

Unable to import java class from clojure?

Project structure:

cloj\
    void2d/
        ...

    vtd.clj
    project.clj

vtd.clj

(import '(void2d Window))

project.clj

(defproject cloj "0.0.1"
  :java-source-paths ["void2d/"])

When I running vtd.clj, I'm getting this:

Execution error (ClassNotFoundException) at java.net.URLClassLoader/findClass (REPL:-1).
void2d.Window

I'm running file with powershell -command clj -M vtd.clj
OS: Windows 10.

I tried to google, but there is no any answers on this question.
What's answer, how to fix it?

project.clj is for Leiningen, not clj .

Install Leiningen (if you don't have it already) and then you should be able to run lein javac to compile your Java source file(s) and then lein repl and you should be able to (load-file "vtd.clj")

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM