In clojure, the answers to How to list the functions of a namespace? are useful if I have a namespace in mind, in particular (ns-imports 'my-package)
can tell me about Java code that has been imported. I can find the list of namespaces with (all-ns)
. Is there a similar way to find the list of all available java packages, and to preview the java classes that have not been imported yet?
I'm making a lot of JARs and .class files available from Leiningen via :resource-paths
and :java-source-paths
respectively. But since I'm new to the Java codebase, I don't actually know off the top of my head what packages are defined in order to import them. I could do something with find, xargs, and grep, but it would be nice to have this information available programmatically. Furthermore, in the future, I would like to be able to do "reflection" over the Java codebase from within Clojure, for instance, noticing when a new class has been defined.
In the LISP world, there is a function called `do-external-symbols' and I googled for that, turning up this discussion from 2007. It seems things have been solved for Clojure itself, but it's less clear about Clojure's view of Java.