problem with Class#getResource

Jochen Theodorou blackdrag at gmx.org
Mon Sep 5 13:15:03 UTC 2016


On 04.09.2016 22:05, Alan Bateman wrote:
> On 04/09/2016 14:35, Jochen Theodorou wrote:
>
>> 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?
> Can you say what "this.class" is in the example? Also do you see any
> difference in behavior between the regular JDK 9 downloads and the
> Jigsaw EA downloads?

this.class is the same as this.getClass().

Anyway... turns out this is working if I make a standalone example. 
Which means the test setup part must do something wrong when forking a 
new JVM.

bye Jochen



More information about the jigsaw-dev mailing list