Object returnValue;
try {
IFn loadFile = Clojure.var("clojure.core", "load-file");
returnValue = loadFile.invoke(file.getCanonicalPath());
} catch (IOException e) {
throw new LoadException(file, e);
}
// We need a Var as the last statement, because we need to retrieve the current namespace.
if (!(returnValue instanceof Var)) {
throw new LoadException(file,
String.format("The last statement does not define a var, but %s.\n", returnValue));
}
Var nodesVar = (Var) returnValue;
Namespace ns = nodesVar.ns;
String namespace = ns.name.getName();