JRuby can access classes implemented in pure Java code. Clojure can generate a class file. Therefore it's straightforward for JRuby to access classes implemented in Clojure.
First I define a class with a method in plain Java.
MrJava.java:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MrJava { | |
public MrJava() { | |
} | |
void hi(String name) { | |
System.out.println("Good afternoon " + name + ", how are you?"); | |
} | |
} |