is ClassLoader.loadClass() supposed to work on module-info classes?

Stephane Epardaud stef at
Wed Dec 2 14:35:29 UTC 2015

On 02/12/15 14:56, Alan Bateman wrote:
> The this_class should be <internal-name>/module-info but in any case, 

The funny thing is that this module-info.class was created by the Java
9+Jigsaw EA "stock" javac. How it got the ".Test" class mixed up in
there is not clear to me. Perhaps as a result of me specifying it to
"jar" with "--main-class"?

> this isn't the way to "define" a module to the run-time. Instead
> modules are defined in layers, with Layer.create the method to create
> a Layer. 

I'm not trying to "define" a module, I'm just running some pre-Java 9
code that scans the jar and uses reflection with "findClass" to load the
class. I've now special-cased it to avoid "module-info.class" but still
I'm surprised it did not work as it does for "package-info.class".

More information about the jigsaw-dev mailing list