Clojure
(Ns r2.test2
(: Gen-class
: Methods [# ^ {: static true} [getMessage [String])
)
(Defn-getMessage [name]
(Println (str ("hello" name "! "))))
JAVA end
Import com. ociweb. clj. Demo; // class created by compiling Clojure source file
Public class Main {
Public static void main (String [] args ){
String message = Demo. getMessage ("Mark ");
System. out. println (message );
}
}
It seems that you can only use it in the command line ..
The following are the steps provided on the website... unfortunately, my brother is not good at English ....
Here are the steps to build and run it.
Cd to the directory containing the src and classes directories.
Start a REPL by entering "clj ".
Enter "(compile 'com. ociweb. clj. Demo )".
Exit the REPL (ctrl-d or ctrl-c ).
Enter "javap-classpath classes com. ociweb. clj. Demo" to see the methods in the generated class.
Enter "javac-cp classes Main. java ".
Enter "java-cp.: classes: path/clojure. jar Main. java". Use semicolons instead of colons under Windows.
The output shocould be "Hello, Mark! ".
Author: Loli-controlled blog"