A Clojure library for accessing Javadocs in your REPL
{:deps {org.clojure/java.doc {:git/url "https://github.com/clojure/java.javadoc"
:git/sha "b534b707270836fecc2f268ee6adf1c7a986d4f7"}}}For usage without modifying your project deps:
;; This require is only necessary if not in user namespace
(require '[clojure.repl.deps :refer [add-lib]])
(add-lib 'io.github.clojure/java.doc {:git/sha "b534b707270836fecc2f268ee6adf1c7a986d4f7"})
(require '[clojure.java.doc.api :refer [jdoc jdoc-data sigs]])
;; Now you can use it
(jdoc String)Invoke directly from the command line, useful for piping into a .md file to display in your editor:
clojure -Sdeps '{:deps {org.clojure/java.doc {:git/url "https://github.com/clojure/java.doc" :git/sha "b534b707270836fecc2f268ee6adf1c7a986d4f7"}}}' \
-M -e "(require '[clojure.java.doc.api :refer [jdoc]]) (jdoc String)"The core namespace provides three functions:
Print Javadoc HTML as Markdown for a class or qualified method (with optional param-tags).
(require '[clojure.java.doc.api :refer [jdoc jdoc-data sigs]])
;; Print class description
(jdoc String)
;; Print all overloads of a method
(jdoc String/valueOf)
;; Specify a specific overload using param-tags
(jdoc ^[char/1] String/valueOf)
;; Use _ to match any type:
(jdoc ^[_ int] String/.substring)Print method signatures in qualified method syntax with param tags.
(sigs String/valueOf)
;; => ^[boolean] String/valueOf
;; ^[char] String/valueOf
;; ^[char/1] String/valueOf
;; ^[char/1 int int] String/valueOf
;; ^[double] String/valueOf
;; ^[float] String/valueOf
;; ^[int] String/valueOf
;; ^[long] String/valueOf
;; ^[Object] String/valueOfReturns all the structured data instead of printing the description.
(jdoc-data String)
;; => {:classname "java.lang.String"
;; :class-description-html "..."
;; :class-description-md "..."
;; :methods [{:signature "valueOf(int i)"
;; :description "Returns the string representation..."
;; :static? true
;; :clojure-call "^[int] String/valueOf"}
;; ...]}
(jdoc-data ^[char/1] String/valueOf)
;; => {:classname "java.lang.String"
;; :class-description-html "..."
;; :class-description-md "..."
;; :methods [...]
;; :selected-method [{:signature "valueOf(char[] data)"
;; :description "Returns the string representation..."
;; :static? true
;; :clojure-call "^[char/1] String/valueOf"
;; :method-description-html "..."
;; :method-description-md "..."}]}- Java 17+
Copyright © 2025
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.