problem with Class#getResource

Uwe Schindler uschindler at
Sun Sep 4 15:32:08 UTC 2016


I think this is related to multi-release JAR files because directories are no longer "unique" for the same resource. I am not 100% sure, but according to specs, Resources are only files, never directories, so I'd always say the above code is wrong and it is just caused by an implementation detail that it works at all. :-)


Uwe Schindler
uschindler at 
ASF Member, Apache Lucene PMC / Committer
Bremen, Germany
> Sent: Sunday, September 4, 2016 3:36 PM
> To: jigsaw-dev at
> Subject: problem with Class#getResource
> Hi all,
> I am using build 9-ea+132
> I have a test, that does in the setup this.class.getResource("/jars"),
> to get a URL to the jars directory. The parent directory is on the
> classpath, but the call returns null... This code is not run in a named
> module.
> Can anyone tell me why that returns null with jigsaw?
> bye Jochen

More information about the jigsaw-dev mailing list