scenerygraphics/spirvcrossj

Running under Java +10 loadNatives always fails due to new reflection restrictions to internal classes

Closed this issue · 4 comments

Hi,
I've updated to Java 11 (from 9) and I have noticed that the loadNatives always fails. After some investigation I concluded that now Reflection.filterFields (that is called when getting any Field) omits all Fields from ClassLoader class. This makes sys_paths effectively inaccessible what causes your code to always fail at native library loading.
For right now I have temporarily fixed this by coping the native file from the temporary direction and placing it in to my run directory where I use this to directly point to the file and load it.

To fix this I suggest replacing the old sys_paths hack with the more official System.load method as I pointed out above.

Hi @LapisSea,

Thanks for the report! You are entirely correct, and I actually already have that on my todo list. Sorry for not addressing this earlier!

That's great!
Yeah no worries it's an easy temporary fix so there is really no damage. ;)

Hi @LapisSea, this issue should be fixed with the latest release. We've switched to using System.load instead of System.loadLibrary, so no more fiddling with the paths is necessary. I shall close this for the moment, should there be more problems, please reopen 👍

Oh hey that's great! Almost forgot there was built in loading... 😆