I found this related question on Stack Overflow, but it didn't really answer my question.
I have a Java application that I've packaged as a JAR file. I also have a Clojure application that I've packaged as a JAR file. I'm now writing another Clojure application that uses the first two as libraries.
Here's the Java code that seems to be the source of my error:
public class ServerBuilder {
private HashMap<String, ResponseObject> routes = new HashMap<String, ResponseObject>();
public int limit;
public ServerSocket serverSocket;
private ThreadBuilder threadBuilder;
public int count;
public ServerBuilder(int limit) {
this.limit = limit;
}
public void begin() throws IOException {
if(getServerSocket() == null) {
this.serverSocket = new ServerSocket(4444);
}
int count = 0;
while(count < limit) {
createThreadBuilder(serverSocket);
new Thread(threadBuilder).start();
count = count + 1;
this.count = count;
}
}
Then in my Clojure code, I'm accessing my Java code like this:
(ns browser_tic_tac_toe.core
(:import (server ServerBuilder)))
(defn -main []
(let [server-builder (ServerBuilder. 100)] ; the error points me to this line
(doto
server-builder (.begin))))
The error I get is:
Exception in thread "main" java.lang.IllegalArgumentException: No matching ctor found for class server.ServerBuilder
I've Googled this and haven't found much. The error apparently means "no matching constructor found for this class", but it appears to me that the constructor does match. That's why I'm confused.
EDIT
I tried changing the type I'm passing (from long to int):
(defn -main []
(let [limit (int 100)
server-builder (ServerBuilder. limit)]
(doto
server-builder (.begin))))