This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-10-10
Channels
- # announcements (3)
- # babashka (3)
- # beginners (83)
- # calva (1)
- # cider (19)
- # clojure (131)
- # clojure-austin (4)
- # clojure-dev (3)
- # clojure-europe (49)
- # clojure-greece (2)
- # clojure-italy (8)
- # clojure-losangeles (18)
- # clojure-nl (14)
- # clojure-poland (1)
- # clojure-uk (65)
- # clojurescript (28)
- # core-async (7)
- # core-logic (3)
- # cursive (2)
- # data-science (1)
- # datomic (98)
- # defnpodcast (1)
- # figwheel-main (6)
- # fulcro (95)
- # graphql (5)
- # hoplon (7)
- # kaocha (1)
- # lein-figwheel (6)
- # luminus (1)
- # nyc (1)
- # off-topic (21)
- # pedestal (1)
- # quil (8)
- # re-frame (15)
- # reagent (106)
- # reitit (15)
- # shadow-cljs (158)
- # sim-testing (1)
- # spacemacs (17)
- # sql (25)
I can get the URL from Timestamp.class.getResource("/" + Timestamp.class.getName().replace('.', '/') + ".class")
That gets me something like jrt:/java.sql/java/sql/Timestamp.class
, but I don’t know how to convert that to a jar.
I can use ModuleFinder to get a ModuleReference which has a location(), but that’s just a jrt:
URL again.
http://openjdk.java.net/jeps/220 seems to suggest there is no jar, instead there is something called a runtime image
Hmm, interesting. So I guess there’s no guaranteed mapping from a jrt:/
to a jar at all. I definitely read somewhere while investigating this that a module is either a jar or an exploded jar, but that may have been someone who didn’t know what they were talking about.
"The src.zip file is now in the lib directory rather than the top-level directory, and this file now includes one directory for each module in the image. IDEs and other tools that read this file will need to be updated"
But that’s the sources, right? I’m looking for the jar containing the actual class file.
> All other files and directories in the lib directory must be treated as private implementation details of the run-time system. They are not intended for external use and their names, format, and content are subject to change without notice.
I guess I should modify my question to better represent what I actually want to do: is it possible to create a classloader with some other classloader as a parent which contains additional system modules which may not be available to the parent?
Actually, I wonder if I can just pass a jrt:/
URL directly to the URLClassLoader constructor
I don't know, but there is also java.lang.ModuleLayer which is maybe a way to get classloaders for modules