caprica / vlcj

Java framework for the vlc media player
http://www.capricasoftware.co.uk/projects/vlcj
1.1k stars 260 forks source link

Cannot use RuntimeUtil with vlcj 4.8.2 #1199

Closed xinyingho closed 6 months ago

xinyingho commented 11 months ago

I got my own implementation of DiscoveryDirectoryProvider and I need to do different things followinbg the OS my app is running on. To discriminate between them I use the convenient methods of RuntimeUtil.

With vlcj 4.8.x, I get an exception at launch telling me: java.lang.IllegalAccessError: class net.babelsoft.negatron.io.Video$LinuxDiscoveryDirectoryProvider (in module negatron) cannot access class uk.co.caprica.vlcj.binding.support.runtime.RuntimeUtil (in module uk.co.caprica.vlcj.natives) because module uk.co.caprica.vlcj.natives does not export uk.co.caprica.vlcj.binding.support.runtime to module negatron

So I have to fiddle with the launch options to force my way around. But the class uk.co.caprica.vlcj.binding.support.runtime.RuntimeUtil should be opened by the vlcj.natives module.

caprica commented 11 months ago

Can you be specific why you need vlcj's RuntimeUtil in your own class?

xinyingho commented 11 months ago

I simply use it to know what is the current OS to add specific user folders. Now that I think about it, I could also use something else if really you want to let this class internal to vlcj but I find it quite convenient.

caprica commented 11 months ago

Well, I don't mind opening it up if it's really needed, but the way the discovery is designed and implemented, it is already partitioned into separate Linux/Windows/macOS discovery implementations, so I'm surprised you need to write logic yourself to determine which environment you're in.

I'm not sure I explained that clearly enough, but my basic point is you can already configure your discovery provider per runtime environment, the idea is that you never yourself in your code need to check the runtime environment if you build your custom provider in the right way.

xinyingho commented 11 months ago

After digging a bit in VLCJ code, there is indeed a whole system with the NativeDiscoveryStrategy interface now while I'm still using the old DiscoveryDirectoryProvider interface. Ok, I need to update my code to use this system then :)

caprica commented 11 months ago

After you've checked all that, let me know if you still can't achieve what you want and I'll see what could be changed.