Loading native libraries from the classpath
Mike Hearn
mike at plan99.net
Thu Jan 18 11:27:23 UTC 2024
Yeah, a new path concept or a flag that modifies the existing
classpath concept would be quite useful.
In Conveyor we had to give up on the module path, apps always have all
jars on the classpath unless the developer forces modules individually
via packaging config. Originally we tried to put explicit non-auto
modules on the module path at jlink time to benefit from the better
jimage encoding but had to stop, as it kept breaking apps. Now even
jars with a module-info are always put on the classpath. JDKs are
minimized by just running jdeps or jar -d on every jar to figure out
the set of JDK modules required, combined with a pile of hacks to
handle that using only explicit declared dependencies breaks apps too
(some modules the JDK treats as optional actually aren't). A lot of
that can be traced to the modulepath/classpath split.
Anyway that's not really relevant for Panama, as anything Panama does
would have to work with non-modular JARs anyway.
On Wed, Jan 17, 2024 at 9:30 PM Ron Pressler <ron.pressler at oracle.com> wrote:
>
> A minor point, but perhaps worth pointing out as I’ve seen others raise the matter:
>
> > On 17 Jan 2024, at 14:34, Mike Hearn <mike at plan99.net> wrote:
> >
> > (perhaps being moved onto the module path automatically, if found on the classpath)
>
> For some entity X containing classes — today a JAR file or a classes directory, but perhaps it could also be a JMOD file — the flag `-p X` means "take the classes in X and place them in a named module, if resolved (whether or not X contains a module declaration)"; the flag `-cp X` means "take the classes in X and place them in an unnamed module (whether or not X contains a module declaration)". In other words, the classpath is what defines the content of the unnamed module.
>
> There is no way for the classpath, which means “put these classes in an unnamed module” to do the opposite of its stated meaning. If someone wants a flag to mean “put X in a named module iff it contains a module declaration” it will need to be a new kind of path that’s distinct from the class path and the module path.
>
> — Ron
More information about the panama-dev
mailing list