Closed Vampire closed 2 weeks ago
As far as I can see the failing builds are a general problem not related to my PR.
Workaround: make sure bridj.jar
is not on the module-path and add it to the classpath instead, then it is not an automatic module but an unnamed module and thus not bound to the restrictions for modules which make the Class#getResource()
call work again and the class path code is not necessary.
I forked BridJ and created a https://jitpack.io build using the msgilligan-master
branch. I have successfully used to build and run webcam-capture on JDK 11/12 in a modular app.
See my comment over in sarxos/webcam-capture for details of the build.gradle
I used.
Thanks @Vampire !!
As there were various commits over the last years, could this PR please finally be considered? If at some time a new release is made, it would be helpful if this fix is in.
Thanks :-)
After
BridJ.class.getResource(path)
failed various class loaders are tried to get the resource. When used as an automatic module on the module path of a Java 9 application this call will always fail as you can only get resources from your own module withClass#getResource()
even if they are opened explicitly. But for getting a resource from the class loader, the path must not start with a slash or will never find anything. Instead the path has to start without a slash and is always evaluated as absolute path. This PR strips the leading slash that is explicitly added before forClass#getResource()
where the leading slash is necessary to have the path treated as absolute path.