Attempting to AOT compile a Clojure namespace with clj -e "(compile 'my-ns.core)"
throws an exception when attempting to construct a LocalDate
:
Syntax error (IllegalArgumentException) compiling . at (my-project/my-ns-core.clj:5:1).
No matching method ofInstant found taking 2 args for class java.time.LocalDate
Works fine in REPL. Why failing in AOT? Classes are imported.
(ns my-ns.core
(:require [clojure.alpha.spec.gen :as g])
(:import (java.time LocalDate))
(LocalDate/ofInstant (Instant/ofEpochMilli 123) (ZoneId/of "UTC"))
I assume this must be related to these classes being included from the AOT build?
GraalVM was in my
$PATH
which took precedence for calls tojava
with an older Java version that did not include the Java 8 date classes. Figured it out by runningwhich java
.Solved with:
And not including
$GRAALVM_HOME
in$PATH
.