"What is my application's classpath?"
It turns out that there is not a straightforward answer to this question.
There are many ways of running Java, each of which may result in different definitions of the application's classpath. The clojure.java.classpath library has, historically, used a variety of heuristics to find and return the Java classpath.
The current approach is a workaround for Java 9, where the default classloader is not an instance of
URLClassLoader. This is now causing problems for CIDER users when
cider-jack-in injects the JDK source path (see below).
I have been looking at the history of clojure.java.classpath, in particular:
There does not seem to be a single approach that will give the right result in all situations.
- Using the system property
java.class.path produces incorrect results in an application container environment (CLASSPATH-1).
- Getting the classpath from URLClassLoaders does not work in Java 9+ (CLASSPATH-8).
- Combining the results would provide more coverage for tools like CIDER and tools.namespace, but would potentially return incorrect results for applications in containers.
I am unsure how to proceed. I am wary of making yet another change to address the most-recent issue, thereby breaking older uses.
See also, discussions at: