Browse Learn Clojure Foundations as a Java Developer

Calling Java from Clojure

Call instance methods, static methods, constructors, and fields from Clojure while keeping reflection, type hints, and object creation explicit at JVM boundaries.

Calling Java from Clojure is direct: you are still on the JVM. The main differences from Java are syntactic and ergonomic, not “capability” differences.

Common shapes you will see:

1(.substring "hello" 1 3)  ;; instance method => "el"
2(Math/abs -3)             ;; static method   => 3

The practical gotcha is reflection: if Clojure cannot infer the target type for an interop call, it may reflect at runtime. That is usually fine at the edges, but it can become a real cost inside tight loops. This section helps you recognize the call forms and know when type hints are worth it.

In this section

  • Java Interop Syntax in Clojure
    Learn the core forms for calling Java from Clojure: static calls, instance calls, field access, constructors, and the type hints that keep hot paths away from reflection.
  • Accessing Java Fields and Properties in Clojure
    Access Java fields and JavaBean-style getters and setters from Clojure without confusing object state with the plain data model used in idiomatic Clojure code.
  • Java Constructors from Clojure
    Create Java objects with Clojure constructor forms, compare them with Java new expressions, and keep object construction localized at interop boundaries.
Revised on Saturday, May 23, 2026